Fokko commented on a change in pull request #6577: [AIRFLOW-5908] Add
download_file to S3 Hook
URL: https://github.com/apache/airflow/pull/6577#discussion_r383956654
##########
File path: airflow/providers/amazon/aws/hooks/s3.py
##########
@@ -652,3 +654,30 @@ def delete_objects(self, bucket, keys):
if "Errors" in response:
errors_keys = [x['Key'] for x in response.get("Errors", [])]
raise AirflowException("Errors when deleting:
{}".format(errors_keys))
+
+ @provide_bucket_name
+ @unify_bucket_name_and_key
+ def download_file(self, key: str, bucket_name: Optional[str] = None,
local_path: str = '/tmp') -> str:
Review comment:
Instead of hardcoding the `/tmp` dir. We could ask this using a Python
function, which is system independent since it will ask the OS for a temp dir:
https://docs.python.org/3/library/tempfile.html#tempfile.mkdtemp
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services