Update Bigquery Client#38950
Conversation
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request updates the BigQuery client library within the Apache Beam codebase by regenerating it from the latest discovery document. The primary purpose of this change is to ensure the client remains synchronized with the current BigQuery API surface, incorporating recent updates to endpoint paths and adding missing documentation regarding required IAM permissions for specific operations. Highlights
New Features🧠 You can now enable Memory (public preview) to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize the Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counterproductive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request updates the BigQuery V2 client, modifying API paths, adding new service methods (such as row access policies and dataset undeletion), and updating authentication scopes and base URLs. Feedback on these changes highlights several critical issues: the removal of the bigquery.readonly scope and the replacement of client credentials with placeholders may break authentication, while the use of Python 2-style super() calls and extremely long lines violates modern Python 3 standards and PEP 8 guidelines.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
| 'https://www.googleapis.com/auth/devstorage.read_only', | ||
| 'https://www.googleapis.com/auth/devstorage.read_write' | ||
| ] | ||
| _SCOPES = ['https://www.googleapis.com/auth/bigquery', 'https://www.googleapis.com/auth/bigquery.insertdata', 'https://www.googleapis.com/auth/cloud-platform', 'https://www.googleapis.com/auth/cloud-platform.read-only', 'https://www.googleapis.com/auth/devstorage.full_control', 'https://www.googleapis.com/auth/devstorage.read_only', 'https://www.googleapis.com/auth/devstorage.read_write'] |
There was a problem hiding this comment.
The scope 'https://www.googleapis.com/auth/bigquery.readonly' has been removed from _SCOPES. If this client is used in environments or with credentials that only have read-only access to BigQuery, removing this scope may cause authentication or authorization failures.\n\nAdditionally, this line is extremely long (345 characters), which violates PEP 8 line length limits. Please format this list across multiple lines to maintain readability.
_SCOPES = [\n 'https://www.googleapis.com/auth/bigquery',\n 'https://www.googleapis.com/auth/bigquery.insertdata',\n 'https://www.googleapis.com/auth/bigquery.readonly',\n 'https://www.googleapis.com/auth/cloud-platform',\n 'https://www.googleapis.com/auth/cloud-platform.read-only',\n 'https://www.googleapis.com/auth/devstorage.full_control',\n 'https://www.googleapis.com/auth/devstorage.read_only',\n 'https://www.googleapis.com/auth/devstorage.read_write'\n ]There was a problem hiding this comment.
I do not see 'https://www.googleapis.com/auth/bigquery.readonly' referenced in https://www.googleapis.com/discovery/v1/apis/bigquery/v2/rest
| _CLIENT_ID = 'CLIENT_ID' | ||
| _CLIENT_SECRET = 'CLIENT_SECRET' |
There was a problem hiding this comment.
The OAuth _CLIENT_ID and _CLIENT_SECRET have been replaced with the placeholder strings 'CLIENT_ID' and 'CLIENT_SECRET'. If any user flows or authentication mechanisms in Beam rely on these default client credentials (for example, when performing interactive user authentication), this change will break them.\n\nIf the generator script gen_client overrode these values, please consider passing the correct client ID and secret to the generator script (using --client_id and --client_secret flags) or restoring the original values.
_CLIENT_ID = '1042881264118.apps.googleusercontent.com'\n _CLIENT_SECRET = 'x_Tw5K8nnjoRAqULM9PFAC2b'There was a problem hiding this comment.
what are these secrets? why are we publishing them?
|
Checks are failing. Will not request review until checks are succeeding. If you'd like to override that behavior, comment |
|
Run Python_ML PreCommit 3.13 |
|
R: @Abacn |
|
Stopping reviewer notifications for this pull request: review requested by someone other than the bot, ceding control. If you'd like to restart, comment |
Prerequisite to fix #34075
Updated with the script
gen_client --discovery_url="https://www.googleapis.com/discovery/v1/apis/bigquery/v2/rest" --overwrite --outdir=sdks/python/apache_beam/io/gcp/internal/clients/bigquery --root_package=apache_beam.io.gcp.internal.clients.bigquery clientGitHub Actions Tests Status (on master branch)
See CI.md for more information about GitHub Actions CI or the workflows README to see a list of phrases to trigger workflows.