fix: include amended user agent in read client#17592
Conversation
There was a problem hiding this comment.
Code Review
This pull request reorganizes imports across several files and updates the _ensure_bqstorage_client method in client.py to append pandas-gbq version information to the client_info user agent when initializing the BigQueryReadClient. It also adds comprehensive unit tests to verify this behavior under different scenarios. The review feedback suggests adding a # type: ignore[assignment] comment to the fallback assignment pandas_gbq = None to prevent potential mypy type-checking errors.
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
| gapic_version=client_info.gapic_version, | ||
| user_agent=amended_user_agent, | ||
| rest_version=client_info.rest_version, | ||
| protobuf_runtime_version=client_info.protobuf_runtime_version, |
There was a problem hiding this comment.
From https://github.com/googleapis/google-cloud-python/actions/runs/28405657720/job/84167435143?pr=17592,
E AttributeError: 'ClientInfo' object has no attribute 'protobuf_runtime_version'
protobuf_runtime_version requires google-api-core 2.25 or newer: https://github.com/googleapis/python-api-core/releases/tag/v2.25.0
>>> import google.api_core.gapic_v1.client_info as client_info
>>> hasattr(client_info.ClientInfo(), 'protobuf_runtime_version')
True
See similar code in google-cloud-language:
Alternatively, we could bump the minimum version of google-api-core since we currently have 2.24.2. Bumping to 2.25 seems reasonable
There was a problem hiding this comment.
See WIP PR #17599 to bump google-api-core for generated libraries. You can also bump google-api-core in this PR for google-cloud-bigquery since it's not automatically generated .
There was a problem hiding this comment.
Thanks for investigating @parthea ! Yes, I'll bump the minimum here too.
|
Switching to draft until presubmits are green |
Towards internal issue b/526614511 🦕