Apache Airflow:操作员将s3复制到s3 [英] Apache Airflow: operator to copy s3 to s3
本文介绍了Apache Airflow:操作员将s3复制到s3的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
将文件从一个s3复制到另一个s3的最佳方法是什么?
我已经尝试过S3FileTransformOperator,但是它需要transform_script或select_expression。我的要求是将确切的文件从源复制到目标。
What is the best operator to copy a file from one s3 to another s3 in airflow? I tried S3FileTransformOperator already but it required either transform_script or select_expression. My requirement is to copy the exact file from source to destination.
推荐答案
您有2个选择(即使我不考虑 Airflow
)
You have 2 options (even when I disregard Airflow
)
- 使用 AWS CLI :
cp
命令
-
aws s3 cp< source> <目的地>
- 在
气流
中,可以使用BashOperator运行此命令
(本地计算机)或SSHOperator
(远程计算机)
-
- Use AWS CLI:
cp
commandaws s3 cp <source> <destination>
- In
Airflow
this command can be run usingBashOperator
(local machine) orSSHOperator
(remote machine)
- 在这里使用
boto3
的S3Client
- Airflow已经以
S3Hook
- 甚至
S3Client
copy_object(..)
方法/ a>可在S3Hook
as(再次)copy_object(..)
- 您可以在任何合适的自定义
operator
或PythonOperator $ c $中使用
S3Hook
c>
- Here you'll be using
boto3
'sS3Client
- Airflow already provides a wrapper over it in form of
S3Hook
- Even
copy_object(..)
method ofS3Client
is available inS3Hook
as (again)copy_object(..)
- You can use
S3Hook
inside any suitable customoperator
or justPythonOperator
这篇关于Apache Airflow:操作员将s3复制到s3的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文