fdemiane commented on code in PR #48107:
URL: https://github.com/apache/airflow/pull/48107#discussion_r2018256229
##########
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:
Is getfo implemented in the SFTPHook? In the unit test we have
sftp_hook.return_value.get_conn.return_value.getfo.
Also, if we are wrapping it in a function, maybe it is better to name it
something different. IMHO, getfo implies that this is a getter with no side
effects, while actually it is not a getter
--
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]