Skip to content

feat: GCP access token support #459

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

Closed

Conversation

Freakachoo
Copy link

Add support for using a temporary GCP Access Token for authenticating.

Changelog

  • added property credentials_access_token for create_engine
  • added unit tests
  • updated Readme

Fixes #42 🦕

@Freakachoo Freakachoo requested a review from a team as a code owner May 11, 2022 11:55
@Freakachoo Freakachoo requested review from a team and prash-mi May 11, 2022 11:55
@google-cla
Copy link

google-cla bot commented May 11, 2022

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

For more information, open the CLA check for this pull request.

@product-auto-label product-auto-label bot added size: m Pull request size is medium. api: bigquery Issues related to the googleapis/python-bigquery-sqlalchemy API. labels May 11, 2022
@Freakachoo Freakachoo changed the title GCP access token support feat: GCP access token support May 11, 2022
@tswast tswast added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label May 25, 2022
Copy link
Collaborator

@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.

Looks good! Just one potential optimization.

@@ -54,6 +55,9 @@ def create_bigquery_client(
)
credentials = credentials.with_scopes(SCOPES)
default_project = credentials.project_id
elif credentials_access_token:
credentials = oauth_credentials.Credentials(credentials_access_token)
_, default_project = google.auth.default(scopes=SCOPES)
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is potentially a slow operation. I we might consider only doing this if project_id is None. Or maybe add a if default_project is None to the if project_id is None if statement below?

@yoshi-kokoro yoshi-kokoro removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label May 25, 2022
@tswast
Copy link
Collaborator

tswast commented May 25, 2022

An optional refresh_token might also be desirable, but not required nor applicable to all use cases.

@meredithslota
Copy link

This PR is pretty stale, opting to close since there haven't been responses to the code review comments. Thanks!

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 googleapis/python-bigquery-sqlalchemy API. size: m Pull request size is medium.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Use OAuth to authenticate against BigQuery
4 participants