Skip to content

Commit

Permalink
Update bigquery.py
Browse files Browse the repository at this point in the history
  • Loading branch information
mlabarrere committed Mar 22, 2021
1 parent f799bef commit eafa1c3
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions pygquery/bigquery.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,16 @@ def data(self):
class BigQueryWriter(Thread):
"""Reads Query"""
def __init__(self, dataframe, project, dataset, table, if_exists,
api_key_path):
api_key_path=None, api_key_json=None):
"""Object Configuration"""
Thread.__init__(self)
credentials = Credentials.from_service_account_file(api_key_path)
if api_key_path is not None :
credentials = Credentials.from_service_account_file(
api_key_path)

elif api_key_json is not None :
credentials = Credentials.from_service_account_info(
api_key_json)
_client = bigquery.Client(credentials=credentials, project=project)

dataset_ref = _client.dataset(dataset)
Expand Down

0 comments on commit eafa1c3

Please sign in to comment.