Skip to content

Commit

Permalink
Add doc for LocalFilesystemToS3Operator
Browse files Browse the repository at this point in the history
  • Loading branch information
vincbeck authored and potiuk committed Mar 29, 2022
1 parent 7dd940d commit 21b9d59
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 2 deletions.
Expand Up @@ -31,11 +31,12 @@
start_date=datetime(2021, 1, 1), # Override to match your needs
catchup=False,
) as dag:
# [START howto_local_transfer_data_to_s3]
# [START howto_transfer_local_to_s3]
create_local_to_s3_job = LocalFilesystemToS3Operator(
task_id="create_local_to_s3_job",
filename="relative/path/to/file.csv",
dest_key=S3_KEY,
dest_bucket=S3_BUCKET,
replace=True,
)
# [END howto_local_transfer_data_to_s3]
# [END howto_transfer_local_to_s3]
4 changes: 4 additions & 0 deletions airflow/providers/amazon/aws/transfers/local_to_s3.py
Expand Up @@ -28,6 +28,10 @@ class LocalFilesystemToS3Operator(BaseOperator):
"""
Uploads a file from a local filesystem to Amazon S3.
.. seealso::
For more information on how to use this operator, take a look at the guide:
:ref:`howto/operator:LocalFilesystemToS3Operator`
:param filename: Path to the local file. Path can be either absolute
(e.g. /path/to/file.ext) or relative (e.g. ../../foo/*/*.csv). (templated)
:param dest_key: The key of the object to copy to. (templated)
Expand Down
1 change: 1 addition & 0 deletions airflow/providers/amazon/provider.yaml
Expand Up @@ -509,6 +509,7 @@ transfers:
python-module: airflow.providers.amazon.aws.transfers.salesforce_to_s3
- source-integration-name: Local
target-integration-name: Amazon Simple Storage Service (S3)
how-to-guide: /docs/apache-airflow-providers-amazon/operators/transfer/local_to_s3.rst
python-module: airflow.providers.amazon.aws.transfers.local_to_s3
- source-integration-name: SQL
target-integration-name: Amazon Simple Storage Service (S3)
Expand Down
@@ -0,0 +1,50 @@
.. Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
.. http://www.apache.org/licenses/LICENSE-2.0
.. Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
Local Filesystem to Amazon S3 Transfer Operator
===============================================

Use the LocalFilesystemToS3Operator transfer to copy data from the Airflow local filesystem
to an Amazon Simple Storage Service (S3) file.

Prerequisite Tasks
^^^^^^^^^^^^^^^^^^

.. include:: ../_partials/prerequisite_tasks.rst

.. _howto/operator:LocalFilesystemToS3Operator:

Local to Amazon S3
^^^^^^^^^^^^^^^^^^

This operator copies data from the local filesystem to an Amazon S3 file.

To get more information about this operator visit:
:class:`~airflow.providers.amazon.aws.transfers.local_to_s3.LocalFilesystemToS3Operator`

Example usage:

.. exampleinclude:: /../../airflow/providers/amazon/aws/example_dags/example_local_to_s3.py
:language: python
:dedent: 4
:start-after: [START howto_transfer_local_to_s3]
:end-before: [END howto_transfer_local_to_s3]

Reference
^^^^^^^^^

* `AWS boto3 Library Documentation for Amazon S3 <https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/s3.html>`__

0 comments on commit 21b9d59

Please sign in to comment.