Skip to content

Read project_id from JSON key file.#93

Merged
tylertreat merged 1 commit intotylertreat:masterfrom
orangain:use-project-id-in-json-key
Apr 23, 2016
Merged

Read project_id from JSON key file.#93
tylertreat merged 1 commit intotylertreat:masterfrom
orangain:use-project-id-in-json-key

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