diff --git a/sqlalchemy_bigquery/_helpers.py b/sqlalchemy_bigquery/_helpers.py index a79859ba..5b481db7 100644 --- a/sqlalchemy_bigquery/_helpers.py +++ b/sqlalchemy_bigquery/_helpers.py @@ -37,6 +37,8 @@ def create_bigquery_client( default_query_job_config=None, location=None, project_id=None, + username=None, + email=None, ): logger.critical( 'yooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo') @@ -63,7 +65,18 @@ def create_bigquery_client( if project_id is None: 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") + + if username is not None: + logger.critical("another one") + logger.critical(username) + + logger.critical("client_info") logger.critical(google_client_info()) logger.critical("projectid") diff --git a/sqlalchemy_bigquery/base.py b/sqlalchemy_bigquery/base.py index ca1772a0..91e3a8fa 100644 --- a/sqlalchemy_bigquery/base.py +++ b/sqlalchemy_bigquery/base.py @@ -802,6 +802,8 @@ def create_connect_args(self, url): credentials_base64, default_query_job_config, list_tables_page_size, + username, + email, ) = parse_url(url) self.arraysize = arraysize or self.arraysize @@ -820,6 +822,8 @@ def create_connect_args(self, url): project_id=project_id, location=self.location, default_query_job_config=default_query_job_config, + username=username, + email=email ) return ([client], {}) diff --git a/sqlalchemy_bigquery/parse_url.py b/sqlalchemy_bigquery/parse_url.py index c7bc8d8d..c4ca133d 100644 --- a/sqlalchemy_bigquery/parse_url.py +++ b/sqlalchemy_bigquery/parse_url.py @@ -46,6 +46,7 @@ def parse_boolean(bool_string): def parse_url(url): # noqa: C901 query = dict(url.query) # need mutable query. + username, email = None, None # use_legacy_sql (legacy) if "use_legacy_sql" in query: @@ -125,6 +126,8 @@ def parse_url(url): # noqa: C901 credentials_base64, QueryJobConfig(), list_tables_page_size, + username, + email, ) else: return ( @@ -136,6 +139,8 @@ def parse_url(url): # noqa: C901 credentials_base64, None, list_tables_page_size, + username, + email, ) job_config = QueryJobConfig() @@ -285,4 +290,6 @@ def parse_url(url): # noqa: C901 credentials_base64, job_config, list_tables_page_size, + username, + email, )