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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs(bigquery): Add alternative approach to setting credentials #517

Merged
merged 3 commits into from Feb 19, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 5 additions & 0 deletions samples/snippets/authenticate_service_account.py
Expand Up @@ -30,6 +30,11 @@ def main():
key_path, scopes=["https://www.googleapis.com/auth/cloud-platform"],
)

# Alternatively, use service_account.Credentials.from_service_account_info()
plamut marked this conversation as resolved.
Show resolved Hide resolved
# to set credentials from a json string rather than read from a file
Copy link
Contributor

Choose a reason for hiding this comment

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

It's not actually a string, though, right? I thought the "info" function takes a parsed value (dictionary).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Right. I will correct that

# TODO(developer): Set key_json to the content of the service account key file.
# credentials = service_account.Credentials.from_service_account_info(key_json)

client = bigquery.Client(credentials=credentials, project=credentials.project_id,)
# [END bigquery_client_json_credentials]
return client
Expand Down