kkulczak commented on code in PR #48107:
URL: https://github.com/apache/airflow/pull/48107#discussion_r2018504281
##########
providers/google/src/airflow/providers/google/cloud/transfers/sftp_to_gcs.py:
##########
@@ -166,16 +173,26 @@ def _copy_single_object(
destination_object,
)
- with NamedTemporaryFile("w") as tmp:
- sftp_hook.retrieve_file(source_path, tmp.name,
prefetch=self.sftp_prefetch)
-
- gcs_hook.upload(
- bucket_name=self.destination_bucket,
- object_name=destination_object,
- filename=tmp.name,
- mime_type=self.mime_type,
- gzip=self.gzip,
- )
+ if self.use_stream:
+ dest_bucket = gcs_hook.get_bucket(self.destination_bucket)
+ dest_blob = dest_bucket.blob(destination_object)
+ with dest_blob.open("wb") as write_stream:
+ sftp_hook.getfo(
Review Comment:
I've just discovered that retrive_file function from SFTPHook uses getfo
when input is a BytesStream.
I've swithced to using it
--
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]