yuseok89 commented on code in PR #77514:
URL: https://github.com/apache/airflow/pull/77514#discussion_r4681359597
##########
providers/amazon/src/airflow/providers/amazon/aws/transfers/s3_to_sftp.py:
##########
@@ -149,7 +149,19 @@ def execute(self, context: Context) -> None:
if isinstance(self.s3_filenames, str):
self.log.info("Getting files in s3://%s/%s", self.s3_bucket,
self.s3_key)
all_keys = s3_hook.list_keys(bucket_name=self.s3_bucket,
prefix=self.s3_key) or []
- filenames = [k[len(self.s3_key) :] for k in all_keys]
+ # A key ending in "/" is a folder marker, such as the S3
console creates for each
+ # folder. An SFTP server cannot store a file at a path ending
in "/", so skip every
+ # marker, not only those that overlap other keys as the
object-store transfers do.
+ folder_markers = [k for k in all_keys if k.endswith("/")]
Review Comment:
With this change, S3ToSFTPOperator would skip every folder marker, while
GCSToSFTPOperator, which writes to the same kind of destination, creates each
marker as a directory by default since #73880. So the same empty folder would
end up on the SFTP server or not, depending on the source bucket.
What do you think about creating the directory here too, instead of skipping
it? The same could apply to S3ToFTPOperator, since FTP has directories as well.
--
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]