You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2022/10/06 09:46:33 UTC

[GitHub] [airflow] alexkruc commented on a diff in pull request #26886: Adding `preserve_file_name` param to `S3Hook.download_file` method

alexkruc commented on code in PR #26886:
URL: https://github.com/apache/airflow/pull/26886#discussion_r988825043


##########
airflow/providers/amazon/aws/hooks/s3.py:
##########
@@ -879,14 +880,23 @@ def delete_objects(self, bucket: str, keys: str | list) -> None:
 
     @provide_bucket_name
     @unify_bucket_name_and_key
-    def download_file(self, key: str, bucket_name: str | None = None, local_path: str | None = None) -> str:
+    def download_file(
+        self,
+        key: str,
+        bucket_name: str | None = None,
+        local_path: str | None = None,
+        preserve_file_name: bool = False,
+    ) -> str:
         """
         Downloads a file from the S3 location to the local file system.
 
         :param key: The key path in S3.
         :param bucket_name: The specific bucket to use.
         :param local_path: The local path to the downloaded file. If no path is provided it will use the
             system's temporary directory.
+        :param preserve_file_name: If you want the downloaded file name to be with the same name as in S3, set
+            this parameter to True. When set to False, a random filename will be generated.

Review Comment:
   Thanks, I've changed the docstring :) 



-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org