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 — fix: error using empty array of structs parameter by plamut · Pull Request #474 · googleapis/python-bigquery

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

Conversation

@plamut

@plamut plamut commented Jan 19, 2021 •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown
Contributor

Fixes #463.

This PR adds an optional type info parameter to ArrayQueryParameter so that array query parameters with STRUCT items can be used in queries even if they are empty. This is a solution similar to the one used in e.g. the Ruby client.

(for non-struct items the type can always be determined by using the array_type argument)

PR checklist:

  • 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)

Sorry, something went wrong.

Uh oh!

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

All reactions
@plamut
fix: error using empty array of structs parameter
748cceb
@plamut
plamut requested review from a team and stephaniewang526 and removed request for a team January 19, 2021 12:43
@product-auto-label product-auto-label Bot added the api: bigquery Issues related to the googleapis/python-bigquery API. label Jan 19, 2021
@google-cla google-cla Bot added the cla: yes This human has signed the Contributor License Agreement. label Jan 19, 2021
@plamut plamut added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Jan 19, 2021
@yoshi-kokoro yoshi-kokoro removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Jan 19, 2021
tswast
tswast suggested changes Jan 22, 2021
View reviewed changes
Comment thread google/cloud/bigquery/query.py Resolved

Uh oh!

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

plamut added 4 commits February 1, 2021 11:48
@plamut
Merge branch 'master' into iss-463
621f352
@plamut
Add QueryParameterType classes
7db73c9
@plamut
Use query parameter types with ArrayQueryParameter
e822aeb
@plamut
Merge branch 'master' into iss-463
d3e9653
@plamut
plamut requested a review from tswast February 4, 2021 12:03
@plamut
Adjust system test to changed ArrayQueryParameter
38d80b8
tswast
tswast suggested changes Feb 19, 2021
View reviewed changes
Comment thread google/cloud/bigquery/query.py Resolved

Uh oh!

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

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

Uh oh!

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

Comment thread google/cloud/bigquery/query.py
raise NotImplementedError


class ScalarQueryParameterType(_AbstractQueryParameterType):

@tswast tswast Feb 19, 2021

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.

I don't think we should do this in this PR, but I'm tempted to ask for an additional set of constants in google.cloud.bigquery.enums that has all the scalar types defined as objects (without name & description). I imagine that will be useful when we eventually create an "array of structs query parameter" code sample.

Sorry, something went wrong.

Uh oh!

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

All reactions

@plamut plamut Feb 20, 2021 •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown
Contributor Author

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.

Sounds reasonable, let's do it in a follow-up PR. 👍

Edit: It's actually very straightforward (if I understood it correctly, that is), thus added that in an extra commit.

Sorry, something went wrong.

Uh oh!

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

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

Uh oh!

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

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

Uh oh!

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

plamut and others added 8 commits February 20, 2021 09:53
@plamut
Merge branch 'master' into iss-463
f414514
@plamut @tswast
Clarify a comment about an assertion
62a31e7
Co-authored-by: Tim Swast <[email protected]>
@plamut
Merge branch 'iss-463' of github.com:plamut/python-bigquery into iss-463
bf96e97
@plamut
Clarify when name/descr. is omitted from API repr
bf7cf6f
@plamut
Rename subtypes to fields
8255028
@plamut
Add fields property to StructQueryParameterType
4411f6d
@plamut
Add a check for empty struct fields
a02c3ee
@plamut
Define scalar SQL parameter types as type objects
058aecf
@plamut
plamut requested a review from tswast February 20, 2021 12:15
@plamut
Merge branch 'master' into iss-463
f00483b
tswast
tswast approved these changes Feb 24, 2021
View reviewed changes
Comment thread google/cloud/bigquery/enums.py
DATETIME = "DATETIME"


class SqlParameterScalarTypes:

@tswast tswast Feb 24, 2021

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.

Beautiful!

Sorry, something went wrong.

Uh oh!

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

plamut reacted with hooray emoji
All reactions
  • 🎉 1 reaction
@tswast
tswast merged commit c1d15f4 into googleapis:master Feb 24, 2021
gcf-merge-on-green Bot pushed a commit that referenced this pull request Feb 25, 2021
@release-please
chore: release 2.10.0 (#533)
81df4ba
🤖 I have created a release \*beep\* \*boop\* 
---
## [2.10.0](https://www.github.com/googleapis/python-bigquery/compare/v2.9.0...v2.10.0) (2021-02-25)


### Features

* add BIGNUMERIC support ([#527](https://www.github.com/googleapis/python-bigquery/issues/527)) ([cc3394f](https://www.github.com/googleapis/python-bigquery/commit/cc3394f80934419eb00c2029bb81c92a696e7d88))


### Bug Fixes

* error using empty array of structs parameter ([#474](https://www.github.com/googleapis/python-bigquery/issues/474)) ([c1d15f4](https://www.github.com/googleapis/python-bigquery/commit/c1d15f4e5da4b7e10c00afffd59a5c7f3ded027a))
* QueryJob.exception() *returns* the errors, not raises them ([#467](https://www.github.com/googleapis/python-bigquery/issues/467)) ([d763279](https://www.github.com/googleapis/python-bigquery/commit/d7632799769248b09a8558ba18f5025ebdd9675a))


### Documentation

* **bigquery:** Add alternative approach to setting credentials ([#517](https://www.github.com/googleapis/python-bigquery/issues/517)) ([60fbf28](https://www.github.com/googleapis/python-bigquery/commit/60fbf287b0d34d5db2e61cce7a5b42735ed43d0e))
* explain retry behavior for DONE jobs ([#532](https://www.github.com/googleapis/python-bigquery/issues/532)) ([696c443](https://www.github.com/googleapis/python-bigquery/commit/696c443f0a6740be0767e12b706a7771bc1460c3))
---


This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
@plamut
plamut deleted the iss-463 branch February 26, 2021 07:49
@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

@stephaniewang526 stephaniewang526 Awaiting requested review from stephaniewang526
1 more reviewer
@tswast tswast tswast 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.

Support arrays of record/structs as query parameters

Uh oh!

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

3 participants

@plamut @tswast @yoshi-kokoro
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.