david30907d commented on a change in pull request #19508:
URL: https://github.com/apache/airflow/pull/19508#discussion_r795129471



##########
File path: airflow/providers/google/cloud/hooks/bigquery.py
##########
@@ -161,6 +161,23 @@ def get_client(self, project_id: Optional[str] = None, 
location: Optional[str] =
             credentials=self._get_credentials(),
         )
 
+    def get_uri(self) -> str:
+        """Override DbApiHook get_uri method for get_sqlalchemy_engine()"""
+        return "bigquery://"
+
+    def get_sqlalchemy_engine(self, engine_kwargs=None):
+        """
+        Get an sqlalchemy_engine object.
+
+        :param engine_kwargs: Kwargs used in :func:`~sqlalchemy.create_engine`.
+        :return: the created engine.
+        """
+        connection = self.get_connection(self.gcp_conn_id)
+        credentials_path = json.loads(connection.extra)[
+            "extra__google_cloud_platform__key_path"
+        ]
+        return create_engine(self.get_uri(), 
credentials_path=credentials_path, **engine_kwargs)

Review comment:
       oh good point, but seems to me that there's no config for passing 
location in it per 
[doc](https://airflow.apache.org/docs/apache-airflow-providers-google/stable/connections/gcp.html#configuring-the-connection)
   
   what do you think if we punt on this and create another PR to tackle it at 
some point 😅 




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to