Skip to content
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

Merged
merged 14 commits into from
May 7, 2019
Merged

Core, BigQuery: refactor 'client_info' support. #7849

merged 14 commits into from
May 7, 2019

Conversation

tseaver
Copy link
Contributor

@tseaver tseaver commented May 2, 2019

Hoist client_info support from google.cloud.bigquery._http.Connection into core's google.cloud._http.Connection.

Toward #7825.

@tseaver tseaver added api: bigquery Issues related to the BigQuery API. api: core labels May 2, 2019
@tseaver tseaver requested review from tswast and crwilcox May 2, 2019 19:19
@tseaver tseaver requested a review from theacodes as a code owner May 2, 2019 19:19
@tseaver tseaver requested a review from a team May 2, 2019 19:19
@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label May 2, 2019
Copy link
Contributor

@tswast tswast left a 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?

@tseaver
Copy link
Contributor Author

tseaver commented May 2, 2019

@tswast

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.

@tseaver tseaver added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label May 3, 2019
@yoshi-kokoro yoshi-kokoro removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label May 3, 2019
_GRPC_VERSION = None


class ClientInfo(object):
Copy link
Contributor Author

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.

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks! Good catch.

@tswast
Copy link
Contributor

tswast commented May 6, 2019

_GRPC_VERSION = None


class ClientInfo(object):
Copy link
Contributor

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
Copy link
Contributor

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.

@tseaver tseaver merged commit fc3b22e into googleapis:master May 7, 2019
@tseaver tseaver deleted the 7825-add-client_info-refactor branch May 7, 2019 15:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: bigquery Issues related to the BigQuery API. api: core cla: yes This human has signed the Contributor License Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants