GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — feat: Support parameterized NUMERIC, BIGNUMERIC, STRING, and BYTES types by jimfulton · Pull Request #673 · googleapis/python-bigquery

This repository was archived by the owner on Mar 6, 2026. It is now read-only.

Conversation

@jimfulton

@jimfulton jimfulton commented May 20, 2021 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly:

  • Make sure to open an issue as a bug/issue before writing your code! That way we can discuss the change, evaluate designs, and agree on the general idea
  • Ensure the tests and linter pass
  • Code coverage does not decrease (if any source code was changed)
  • Appropriate docs were updated (if necessary)

Fixes #668 🦕

Some notes:

  • I verified that the server:
    • enforces STRING maxLen and NUMERIC precision.
    • Enforces scale by truncating values.
  • select * loses type-parameter information. :( but client.list_rows doesn't.
  • I was thinking of trying to make sure that the Decimal objects created in Python matched the NUMERIC parameters, however
    • Because SELECT loses type information, it's mostly unavailable. IDK how often people use list_rows.
    • Because BQ sends data to the client as strings, this mostly just works, however:
      • The strings sent to the client lack trailing zeros. So, for example, given a scale of 2 and a value 123,
        BQ sends 123 rather than 123.00, so the Python Decimal doesn't have the right number of trailing digits.
        This is easy to fix, but incurs some performance overhead. IDK if we want to do this. If we do, we can do it
        in a follow-on PR.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Jim Fulton added 10 commits May 19, 2021 17:08
Jim Fulton
parse parameterized schema info
6bb6947
Jim Fulton
Fixed SchemaField repr/key
f046fed
Jim Fulton
Fix code duplication between _parse_schema_resource and from_api_repr
d8199f0
Move new parameterized-type code from _parse_schema_resource to from_api_repr
and implement _parse_schema_resource in terms of from_api_repr.
Jim Fulton
empty schemas are lists now, just like non-empty schemas.
8273afe
Jim Fulton
changed new parameterized-type tests to use from_api_repr
acc6f46
Because that's more direct and it uncovered duplicate code.
Jim Fulton
paramaterized the from_api_repr tests and added to_api_repr tests
c01bc1a
Jim Fulton
Test BYTES and _key (repr) too.
2ab558c
Jim Fulton
Added a round-trip parameterized types schema tests
2d021ae
Jim Fulton
handle BYTES in _key/repr
4a1e4b7
Jim Fulton
blacken
c4056b0
@product-auto-label product-auto-label Bot added the api: bigquery Issues related to the googleapis/python-bigquery API. label May 20, 2021
@jimfulton jimfulton changed the title feat: Support parameterized NUMERIC, STRING, and BYTES types. feat: Support parameterized NUMERIC, STRING, and BYTES types May 20, 2021
@google-cla google-cla Bot added the cla: yes This human has signed the Contributor License Agreement. label May 20, 2021
Jim Fulton added 2 commits May 20, 2021 10:51
Jim Fulton
Move _get_int close to use
a238036
Jim Fulton
Updated documentation.
554696b
@jimfulton
jimfulton marked this pull request as ready for review May 20, 2021 17:55
@jimfulton
jimfulton requested review from a team and prash-mi and removed request for a team May 20, 2021 17:55
Jim Fulton
Oops, forgot BIGNUMERIC
9f5cbd5
@jimfulton jimfulton changed the title feat: Support parameterized NUMERIC, STRING, and BYTES types feat: Support parameterized NUMERIC, BIGNUMERIC, STRING, and BYTES types May 20, 2021
plamut
plamut reviewed May 21, 2021
View reviewed changes

@plamut plamut left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, just a few minor remarks that were supposed (?) to be caught by the linters.

The only more significant one is about the (non) cleanup in system tests.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread google/cloud/bigquery/schema.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread google/cloud/bigquery/schema.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread google/cloud/bigquery/schema.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread tests/system/test_client.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Jim Fulton added 3 commits May 21, 2021 09:15
Jim Fulton
Improve argument doc and better argument name to __get_int
32226e1
Jim Fulton
doom tables before creating them.
01b714b
Jim Fulton
Use max_length in the Python for the REST api maxLength
cac957b
plamut
plamut approved these changes May 21, 2021
View reviewed changes

@plamut plamut left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@plamut
plamut merged commit 45421e7 into master May 21, 2021
@plamut
plamut deleted the riversnake-669-parameterized-schemafield branch May 21, 2021 16:50
@release-please release-please Bot mentioned this pull request Jan 4, 2022
chore(main): release python-bigquery 1.27.1 #1097
Closed
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Reviewers

@prash-mi prash-mi Awaiting requested review from prash-mi
1 more reviewer
@plamut plamut plamut approved these changes
Reviewers whose approvals may not affect merge requirements

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

api: bigquery Issues related to the googleapis/python-bigquery API. cla: yes This human has signed the Contributor License Agreement.

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Parameterized Types

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@jimfulton @plamut
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.