Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 14 additions & 20 deletions sqlalchemy_bigquery/_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"https://www.googleapis.com/auth/bigquery",
"https://www.googleapis.com/auth/cloud-platform",
"https://www.googleapis.com/auth/drive",
"email",
)


Expand All @@ -30,6 +31,8 @@ def google_client_info():

logger = logging.getLogger()

# Create a new google client on query run, database added, dataset added
# username and email fields are added for impersonation from parse_url (attributes are part of URL object)
def create_bigquery_client(
credentials_info=None,
credentials_path=None,
Expand All @@ -40,8 +43,6 @@ def create_bigquery_client(
username=None,
email=None,
):
logger.critical(
'yooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo')

default_project = None

Expand All @@ -67,26 +68,19 @@ def create_bigquery_client(
project_id = default_project

if email is not None:
logger.critical("WE IN BOYS")
logger.critical(email)
# credentials = credentials.with_scopes(['email'])
# credentials = credentials.with_subject("vedantprajapati@geotab.com")
logger.debug("email: {}".format(email))
# credentials = credentials.with_scopes(SCOPES + ("email"))
credentials = credentials.with_subject("vedantprajapati@geotab.com")

if username is not None:
logger.critical("another one")
logger.critical(username)


logger.critical("client_info")
logger.critical(google_client_info())
logger.critical("projectid")
logger.critical(project_id)
logger.critical("credentials")
logger.critical(credentials)
logger.critical("location")
logger.critical(location)
logger.critical("queryjobconfig")
logger.critical(default_query_job_config)
logger.debug("username: {}".format(username))


logger.debug("client_info: {}".format(google_client_info()))
logger.debug("projectid: {}".format(project_id))
logger.debug("credentials info: {}".format(credentials))
logger.debug("location {}".format(location))
logger.debug("queryjobconfig {}".format(default_query_job_config))

return bigquery.Client(
client_info=google_client_info(),
Expand Down