Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

BigQuery: Add support for array parameters to Cursor.execute()#9189

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
plamut merged 2 commits intogoogleapis:masterfromplamut:iss-9177
Sep 10, 2019

Conversation

@plamut
Copy link
Contributor

@plamutplamut commentedSep 9, 2019
edited
Loading

Closes#9177.

This PR adds support for array-like query parameters.

How to test

Run the example from the issue description (slightly modified, see below). Binding an array-like parameter to a parametrized query should not raise an error, and the following should work as expected:

curr.execute(query, (('NY','TX'), ))

Mind that scanning arrays requires usingIN UNNEST(...) construct (docs), thus theUNNEST function needs to be added to the query from the issue description:

query="""  SELECT name, state  FROM `bigquery-public-data.usa_names.usa_1910_2013`  WHERE state IN UNNEST(%s)  LIMIT 2"""

Footnotes

  • No nested arrays support, only for arrays of scalar types.
  • Detecting if a value is "array-like" is approximate, it primarily tries to cover the most common cases.

@plamutplamut added the api: bigqueryIssues related to the BigQuery API. labelSep 9, 2019
@plamutplamut requested a review froma teamSeptember 9, 2019 16:27
@googlebotgooglebot added the cla: yesThis human has signed the Contributor License Agreement. labelSep 9, 2019
Copy link
Contributor

@tswasttswast left a comment

Choose a reason for hiding this comment

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

Looking good. Just want to make sure we don't confuse dictionaries as if they were array-like.

@plamutplamut requested a review fromtswastSeptember 10, 2019 08:30
@plamutplamut merged commitadfc6d3 intogoogleapis:masterSep 10, 2019
@plamutplamut deleted the iss-9177 branchSeptember 10, 2019 19:09
emar-kar pushed a commit to MaxxleLLC/google-cloud-python that referenced this pull requestSep 11, 2019
…eapis#9189)* Add support for array params to Cursor.execute()* Raise NotImplementedError for STRUCT-like values
emar-kar pushed a commit to MaxxleLLC/google-cloud-python that referenced this pull requestSep 18, 2019
…eapis#9189)* Add support for array params to Cursor.execute()* Raise NotImplementedError for STRUCT-like values
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@tswasttswasttswast approved these changes

Assignees

No one assigned

Labels

api: bigqueryIssues related to the BigQuery API.cla: yesThis human has signed the Contributor License Agreement.

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

BigQuery: Support WHERE IN or WHERE ANY clause in DB-API

3 participants

@plamut@tswast@googlebot

[8]ページ先頭

©2009-2025 Movatter.jp