SQL to Amazon S3 Transfer Operator¶
Use SqlToS3Operator to copy data from a SQL server to an Amazon Simple Storage Service (S3) file. SqlToS3Operator is compatible with any SQL connection as long as the SQL hook has function that converts the SQL result to pandas dataframe (e.g. MySQL, Hive, ...).
Prerequisite Tasks¶
To use these operators, you must do a few things:
Create necessary resources using AWS Console or AWS CLI.
Install API libraries via pip.
pip install 'apache-airflow[amazon]'
Detailed information is available Installation
MySQL to Amazon S3¶
This example sends the response of a MySQL query to an Amazon S3 file.
To get more information about this operator visit:
SqlToS3Operator
Example usage:
sql_to_s3_task = SqlToS3Operator(
task_id="sql_to_s3_task",
sql_conn_id="mysql_default",
query=SQL_QUERY,
s3_bucket=S3_BUCKET,
s3_key=S3_KEY,
replace=True,
)