Skip to content

Read project_id from JSON key file. #93

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

Merged
merged 1 commit into from
Apr 23, 2016

Conversation

orangain
Copy link
Contributor

A JSON key file provided by Google contains project_id. Now project_id argument of get_client() is optional and read from the JSON key file if json_key or json_key_file is provided. I believe this improve usability of get_client().

Before:

import json
with open('credentials.json') as f:
    credentials = json.load(f)
client = bigquery.get_client(credentials['project_id'], json_key=credentials, readonly=False)

After:

client = bigquery.get_client(json_key_file='credentials.json', readonly=False)

To implement this, I've reverted some codes changed by #91.

A JSON key file provided by Google contains project_id. Now project_id
argument of get_client() is optional and read from the JSON key file if
json_key or json_key_file is provided. I believe this improve usability of
get_client().
@tylertreat
Copy link
Owner

Thanks!

@tylertreat tylertreat merged commit 2904a1b into tylertreat:master Apr 23, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants