kaxil closed pull request #4254: [AIRFLOW-3416] Fixes Python 3 compatibility
with CloudSqlQueryOperator
URL: https://github.com/apache/incubator-airflow/pull/4254
This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:
As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):
diff --git a/airflow/contrib/example_dags/example_gcp_sql_query.py
b/airflow/contrib/example_dags/example_gcp_sql_query.py
index af7c5c2447..5439fb6afc 100644
--- a/airflow/contrib/example_dags/example_gcp_sql_query.py
+++ b/airflow/contrib/example_dags/example_gcp_sql_query.py
@@ -188,7 +188,7 @@
# MySQL: connect via proxy over UNIX socket using pre-downloaded Cloud Sql
Proxy binary
try:
sql_proxy_binary_path = subprocess.check_output(
- ['which', 'cloud_sql_proxy']).rstrip()
+ ['which', 'cloud_sql_proxy']).decode('utf-8').rstrip()
except subprocess.CalledProcessError:
sql_proxy_binary_path = "/tmp/anyhow_download_cloud_sql_proxy"
diff --git a/airflow/contrib/hooks/gcp_sql_hook.py
b/airflow/contrib/hooks/gcp_sql_hook.py
index aee0098b07..43e664d15c 100644
--- a/airflow/contrib/hooks/gcp_sql_hook.py
+++ b/airflow/contrib/hooks/gcp_sql_hook.py
@@ -463,7 +463,7 @@ def start_proxy(self):
self.log.info("The pid of cloud_sql_proxy: {}".format(
self.sql_proxy_process.pid))
while True:
- line = self.sql_proxy_process.stderr.readline()
+ line = self.sql_proxy_process.stderr.readline().decode('utf-8')
return_code = self.sql_proxy_process.poll()
if line == '' and return_code is not None:
self.sql_proxy_process = None
@@ -522,7 +522,7 @@ def get_proxy_version(self):
command_to_run = [self.sql_proxy_path]
command_to_run.extend(['--version'])
command_to_run.extend(self._get_credential_parameters())
- result = subprocess.check_output(command_to_run)
+ result = subprocess.check_output(command_to_run).decode('utf-8')
pattern = re.compile("^.*[V|v]ersion ([^;]*);.*$")
m = pattern.match(result)
if m:
----------------------------------------------------------------
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:
[email protected]
With regards,
Apache Git Services