-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Core, BigQuery: refactor 'client_info' support. #7849
Core, BigQuery: refactor 'client_info' support. #7849
Conversation
Deprecate the 'USER_AGENT' and '_EXTRA_HEADERS' class-level attributes.
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.
We'll need to bump the min version of the dependency on google-cloud-core in google-cloud-bigquery, though, right?
Yes, and for the other manual / JSON clients which will rely on this feature in future PRs. |
_GRPC_VERSION = None | ||
|
||
|
||
class ClientInfo(object): |
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.
@tswast In order to support the API libraries which do not install grpc, I had to split out a base ClientInfo
class which is importable if 'grpc' is absent. The one in google.api_core.gapic_v1.client_info
subclasses and adds the to_grpc_metadata
method.
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.
Thanks! Good catch.
Let's add |
_GRPC_VERSION = None | ||
|
||
|
||
class ClientInfo(object): |
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.
Thanks! Good catch.
|
||
try: | ||
_GRPC_VERSION = pkg_resources.get_distribution("grpcio").version | ||
except pkg_resources.DistributionNotFound: # pragma: NO COVER |
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.
Should we add a unit test for this? It'd be good to be doubly sure that it doesn't blow up when _GRPC_VERSION
is None
.
Hoist
client_info
support fromgoogle.cloud.bigquery._http.Connection
into core'sgoogle.cloud._http.Connection
.Toward #7825.