Repository: incubator-airflow
Updated Branches:
  refs/heads/master 6b2dec910 -> 9218a2167


[AIRFLOW-1613] Make MySqlToGoogleCloudStorageOperator compaitible with python3

Closes #2609 from 
jgao54/make-MySqlToGoogleCloudStorageOperator-python3-compaitible


Project: http://git-wip-us.apache.org/repos/asf/incubator-airflow/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-airflow/commit/9218a216
Tree: http://git-wip-us.apache.org/repos/asf/incubator-airflow/tree/9218a216
Diff: http://git-wip-us.apache.org/repos/asf/incubator-airflow/diff/9218a216

Branch: refs/heads/master
Commit: 9218a21672800252bd8ae5977431bf3ea5aad8e9
Parents: 6b2dec9
Author: Joy Gao <j...@wepay.com>
Authored: Thu Sep 14 14:33:59 2017 -0700
Committer: Chris Riccomini <criccom...@apache.org>
Committed: Thu Sep 14 14:34:17 2017 -0700

----------------------------------------------------------------------
 airflow/contrib/operators/mysql_to_gcs.py | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-airflow/blob/9218a216/airflow/contrib/operators/mysql_to_gcs.py
----------------------------------------------------------------------
diff --git a/airflow/contrib/operators/mysql_to_gcs.py 
b/airflow/contrib/operators/mysql_to_gcs.py
index 7e83bce..f7b3a5a 100644
--- a/airflow/contrib/operators/mysql_to_gcs.py
+++ b/airflow/contrib/operators/mysql_to_gcs.py
@@ -120,9 +120,9 @@ class MySqlToGoogleCloudStorageOperator(BaseOperator):
             names in GCS, and values are file handles to local files that
             contain the data for the GCS objects.
         """
-        schema = map(lambda schema_tuple: schema_tuple[0], cursor.description)
+        schema = list(map(lambda schema_tuple: schema_tuple[0], 
cursor.description))
         file_no = 0
-        tmp_file_handle = NamedTemporaryFile(delete=True)
+        tmp_file_handle = NamedTemporaryFile(mode='w', delete=True)
         tmp_file_handles = {self.filename.format(file_no): tmp_file_handle}
 
         for row in cursor:
@@ -139,7 +139,7 @@ class MySqlToGoogleCloudStorageOperator(BaseOperator):
             # Stop if the file exceeds the file size limit.
             if tmp_file_handle.tell() >= self.approx_max_file_size_bytes:
                 file_no += 1
-                tmp_file_handle = NamedTemporaryFile(delete=True)
+                tmp_file_handle = NamedTemporaryFile(mode='w', delete=True)
                 tmp_file_handles[self.filename.format(file_no)] = 
tmp_file_handle
 
         return tmp_file_handles
@@ -169,7 +169,7 @@ class MySqlToGoogleCloudStorageOperator(BaseOperator):
             })
 
         self.logger.info('Using schema for %s: %s', self.schema_filename, 
schema)
-        tmp_schema_file_handle = NamedTemporaryFile(delete=True)
+        tmp_schema_file_handle = NamedTemporaryFile(mode='w', delete=True)
         json.dump(schema, tmp_schema_file_handle)
         return {self.schema_filename: tmp_schema_file_handle}
 

Reply via email to