From 8e74ade0106d4c59fefb567f02b627aed6050e4d Mon Sep 17 00:00:00 2001 From: Vedant Prajapati Date: Wed, 9 Mar 2022 09:01:28 -0500 Subject: [PATCH 1/6] added email and username field to parseurl output --- sqlalchemy_bigquery/_helpers.py | 10 +++++++++- sqlalchemy_bigquery/base.py | 4 ++++ sqlalchemy_bigquery/parse_url.py | 3 +++ 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/sqlalchemy_bigquery/_helpers.py b/sqlalchemy_bigquery/_helpers.py index a79859ba..dbd8a2e3 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,13 @@ def create_bigquery_client( if project_id is None: project_id = default_project - + + logger.critical(email, username) + if email is not None and username is not None: + logger.critical("WE IN BOYS") + credentials = credentials.with_scopes(['email']) + credentials = credentials.with_subject("vedantprajapati@geotab.com") + 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..9df1f9db 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 # use_legacy_sql (legacy) if "use_legacy_sql" in query: @@ -285,4 +286,6 @@ def parse_url(url): # noqa: C901 credentials_base64, job_config, list_tables_page_size, + username, + email, ) From f731412eb9e05a9c00f5e782106426a7e98a1fb5 Mon Sep 17 00:00:00 2001 From: Vedant Prajapati Date: Wed, 9 Mar 2022 09:06:39 -0500 Subject: [PATCH 2/6] removed with_subject call --- sqlalchemy_bigquery/_helpers.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sqlalchemy_bigquery/_helpers.py b/sqlalchemy_bigquery/_helpers.py index dbd8a2e3..4794a3ae 100644 --- a/sqlalchemy_bigquery/_helpers.py +++ b/sqlalchemy_bigquery/_helpers.py @@ -69,8 +69,8 @@ def create_bigquery_client( logger.critical(email, username) if email is not None and username is not None: logger.critical("WE IN BOYS") - credentials = credentials.with_scopes(['email']) - credentials = credentials.with_subject("vedantprajapati@geotab.com") + # credentials = credentials.with_scopes(['email']) + # credentials = credentials.with_subject("vedantprajapati@geotab.com") logger.critical("client_info") logger.critical(google_client_info()) From 6b6b008bc5f0695b0c98b8b6b74d3254007798eb Mon Sep 17 00:00:00 2001 From: Vedant Prajapati Date: Wed, 9 Mar 2022 09:13:34 -0500 Subject: [PATCH 3/6] removed with_subject call --- sqlalchemy_bigquery/_helpers.py | 10 +++++----- sqlalchemy_bigquery/base.py | 8 ++++---- sqlalchemy_bigquery/parse_url.py | 4 ++-- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/sqlalchemy_bigquery/_helpers.py b/sqlalchemy_bigquery/_helpers.py index 4794a3ae..94c0b5b3 100644 --- a/sqlalchemy_bigquery/_helpers.py +++ b/sqlalchemy_bigquery/_helpers.py @@ -37,8 +37,8 @@ def create_bigquery_client( default_query_job_config=None, location=None, project_id=None, - username=None, - email=None, + # username=None, + # email=None, ): logger.critical( 'yooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo') @@ -66,9 +66,9 @@ def create_bigquery_client( if project_id is None: project_id = default_project - logger.critical(email, username) - if email is not None and username is not None: - logger.critical("WE IN BOYS") + # logger.critical(email, username) + # if email is not None and username is not None: + # logger.critical("WE IN BOYS") # credentials = credentials.with_scopes(['email']) # credentials = credentials.with_subject("vedantprajapati@geotab.com") diff --git a/sqlalchemy_bigquery/base.py b/sqlalchemy_bigquery/base.py index 91e3a8fa..ba9aadfe 100644 --- a/sqlalchemy_bigquery/base.py +++ b/sqlalchemy_bigquery/base.py @@ -802,8 +802,8 @@ def create_connect_args(self, url): credentials_base64, default_query_job_config, list_tables_page_size, - username, - email, + # username, + # email, ) = parse_url(url) self.arraysize = arraysize or self.arraysize @@ -822,8 +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 + # username=username, + # email=email ) return ([client], {}) diff --git a/sqlalchemy_bigquery/parse_url.py b/sqlalchemy_bigquery/parse_url.py index 9df1f9db..7f1c09c4 100644 --- a/sqlalchemy_bigquery/parse_url.py +++ b/sqlalchemy_bigquery/parse_url.py @@ -286,6 +286,6 @@ def parse_url(url): # noqa: C901 credentials_base64, job_config, list_tables_page_size, - username, - email, + # username, + # email, ) From 8f43759c973e4830f0e98f19122f65e07315cc6a Mon Sep 17 00:00:00 2001 From: Vedant Prajapati Date: Wed, 9 Mar 2022 09:22:42 -0500 Subject: [PATCH 4/6] synatax error --- sqlalchemy_bigquery/parse_url.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sqlalchemy_bigquery/parse_url.py b/sqlalchemy_bigquery/parse_url.py index 7f1c09c4..3f800de6 100644 --- a/sqlalchemy_bigquery/parse_url.py +++ b/sqlalchemy_bigquery/parse_url.py @@ -46,7 +46,7 @@ def parse_boolean(bool_string): def parse_url(url): # noqa: C901 query = dict(url.query) # need mutable query. - username, email = None + username, email = None, None # use_legacy_sql (legacy) if "use_legacy_sql" in query: From 0c4bc3795c10384b53294e592f04bed14d3427c5 Mon Sep 17 00:00:00 2001 From: Vedant Prajapati Date: Wed, 9 Mar 2022 09:28:28 -0500 Subject: [PATCH 5/6] added email arg --- sqlalchemy_bigquery/_helpers.py | 14 +++++++++----- sqlalchemy_bigquery/base.py | 8 ++++---- sqlalchemy_bigquery/parse_url.py | 8 ++++++-- 3 files changed, 19 insertions(+), 11 deletions(-) diff --git a/sqlalchemy_bigquery/_helpers.py b/sqlalchemy_bigquery/_helpers.py index 94c0b5b3..b72cfe00 100644 --- a/sqlalchemy_bigquery/_helpers.py +++ b/sqlalchemy_bigquery/_helpers.py @@ -37,8 +37,8 @@ def create_bigquery_client( default_query_job_config=None, location=None, project_id=None, - # username=None, - # email=None, + username=None, + email=None, ): logger.critical( 'yooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo') @@ -66,11 +66,15 @@ def create_bigquery_client( if project_id is None: project_id = default_project - # logger.critical(email, username) - # if email is not None and username is not None: - # logger.critical("WE IN BOYS") + logger.critical(email, username) + if email is not None: + logger.critical("WE IN BOYS") # credentials = credentials.with_scopes(['email']) # credentials = credentials.with_subject("vedantprajapati@geotab.com") + + if username is not None: + logger.critical("another one") + logger.critical("client_info") logger.critical(google_client_info()) diff --git a/sqlalchemy_bigquery/base.py b/sqlalchemy_bigquery/base.py index ba9aadfe..91e3a8fa 100644 --- a/sqlalchemy_bigquery/base.py +++ b/sqlalchemy_bigquery/base.py @@ -802,8 +802,8 @@ def create_connect_args(self, url): credentials_base64, default_query_job_config, list_tables_page_size, - # username, - # email, + username, + email, ) = parse_url(url) self.arraysize = arraysize or self.arraysize @@ -822,8 +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 + username=username, + email=email ) return ([client], {}) diff --git a/sqlalchemy_bigquery/parse_url.py b/sqlalchemy_bigquery/parse_url.py index 3f800de6..c4ca133d 100644 --- a/sqlalchemy_bigquery/parse_url.py +++ b/sqlalchemy_bigquery/parse_url.py @@ -126,6 +126,8 @@ def parse_url(url): # noqa: C901 credentials_base64, QueryJobConfig(), list_tables_page_size, + username, + email, ) else: return ( @@ -137,6 +139,8 @@ def parse_url(url): # noqa: C901 credentials_base64, None, list_tables_page_size, + username, + email, ) job_config = QueryJobConfig() @@ -286,6 +290,6 @@ def parse_url(url): # noqa: C901 credentials_base64, job_config, list_tables_page_size, - # username, - # email, + username, + email, ) From 079b48108a2109d969cb1c710fb6b797ba0c3486 Mon Sep 17 00:00:00 2001 From: Vedant Prajapati Date: Wed, 9 Mar 2022 09:38:07 -0500 Subject: [PATCH 6/6] moved log statement --- sqlalchemy_bigquery/_helpers.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sqlalchemy_bigquery/_helpers.py b/sqlalchemy_bigquery/_helpers.py index b72cfe00..5b481db7 100644 --- a/sqlalchemy_bigquery/_helpers.py +++ b/sqlalchemy_bigquery/_helpers.py @@ -66,14 +66,15 @@ def create_bigquery_client( if project_id is None: project_id = default_project - logger.critical(email, username) 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")