airflow-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <>
Subject [GitHub] potiuk commented on a change in pull request #4170: [AIRFLOW-3275] Implement Google Cloud SQL Query operator
Date Mon, 12 Nov 2018 10:15:42 GMT
potiuk commented on a change in pull request #4170: [AIRFLOW-3275] Implement Google Cloud SQL
Query operator

 File path: airflow/contrib/hooks/
 @@ -261,3 +280,559 @@ def _wait_for_operation_to_complete(self, project_id, operation_name):
                 # No meaningful info to return from the response in case of success
                 return True
+    "{}/cloud_sql_proxy.{}.{}"
+GCP_CREDENTIALS_KEY_PATH = "extra__google_cloud_platform__key_path"
+GCP_CREDENTIALS_KEYFILE_DICT = "extra__google_cloud_platform__keyfile_dict"
+class CloudSqlProxyRunner(LoggingMixin):
+    """Downloads and runs cloud-sql-proxy as subprocess of the python process.
+    The cloud-sql-proxy needs to be downloaded and started before we can connect
+    to the Google Cloud SQL instance via database connection. It establishes
+    secure tunnel connection to the database - it authorizes using the
+    GCP credentials that are passed by the configuration.
+    More details about the proxy can be found here:
+    """
+    def __init__(self,
+                 path_prefix,
+                 instance_specification,
+                 gcp_conn_id='google_cloud_default',
+                 project_id=None,
+                 sql_proxy_version=None,
+                 sql_proxy_binary_path=None):
+        """
+        Creates the proxy runner class.
+        :param path_prefix: unique path prefix where proxy will be downloaded and
+               directories created for unix sockets.
+        :type path_prefix: str
+        :param instance_specification: specification of the instance to connect the
+            proxy to. It should be specified in the form that is described in
+   in
+            -instances parameter (typically in the form of <project>:<region>:<instance>
+            for UNIX socket connections and in the form of
+            <project>:<region>:<instance>=tcp:<port> for TCP connections.
+        :type instance_specification: str
+        :param gcp_conn_id: id of Google Cloud Platform connection to use for
+            authentication
+        :type: str
+        :param project_id: optional id of the GCP project to connect to - it overwrites
+              default project id taken from the GCP connection
+        :type project_id: str
+        :param sql_proxy_version: specific version of SQL proxy to download
+            (for example 'v1.13'). By default latest version is downloaded.
+        :type sql_proxy_version: str
+        :param sql_proxy_binary_path: If specified, then proxy will be
+              used from the path specified rather than dynamically generated. This means
 Review comment:

This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:

With regards,
Apache Git Services

View raw message