You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by bo...@apache.org on 2017/09/30 06:28:19 UTC
incubator-airflow git commit: [AIRFLOW-1664] write file as binary
instead of str
Repository: incubator-airflow
Updated Branches:
refs/heads/master a1b2c0feb -> 95a4136a1
[AIRFLOW-1664] write file as binary instead of str
Closes #2649 from jgao54/write-binary
Project: http://git-wip-us.apache.org/repos/asf/incubator-airflow/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-airflow/commit/95a4136a
Tree: http://git-wip-us.apache.org/repos/asf/incubator-airflow/tree/95a4136a
Diff: http://git-wip-us.apache.org/repos/asf/incubator-airflow/diff/95a4136a
Branch: refs/heads/master
Commit: 95a4136a134cdf4210ee1bc078dd93c620386c91
Parents: a1b2c0f
Author: Joy Gao <jo...@wepay.com>
Authored: Sat Sep 30 08:28:10 2017 +0200
Committer: Bolke de Bruin <bo...@xs4all.nl>
Committed: Sat Sep 30 08:28:10 2017 +0200
----------------------------------------------------------------------
airflow/contrib/operators/mysql_to_gcs.py | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-airflow/blob/95a4136a/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 c8ebcd0..f94bc24 100644
--- a/airflow/contrib/operators/mysql_to_gcs.py
+++ b/airflow/contrib/operators/mysql_to_gcs.py
@@ -122,7 +122,7 @@ class MySqlToGoogleCloudStorageOperator(BaseOperator):
"""
schema = list(map(lambda schema_tuple: schema_tuple[0], cursor.description))
file_no = 0
- tmp_file_handle = NamedTemporaryFile(mode='w', delete=True)
+ tmp_file_handle = NamedTemporaryFile(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(mode='w', delete=True)
+ tmp_file_handle = NamedTemporaryFile(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.log.info('Using schema for %s: %s', self.schema_filename, schema)
- tmp_schema_file_handle = NamedTemporaryFile(mode='w', delete=True)
+ tmp_schema_file_handle = NamedTemporaryFile(delete=True)
json.dump(schema, tmp_schema_file_handle)
return {self.schema_filename: tmp_schema_file_handle}