blob: ac503a46e0ca58e24901150fbabca2522f60c6a4 [file] [log] [blame]
:py:mod:`airflow.providers.microsoft.azure.transfers.sftp_to_wasb`
==================================================================
.. py:module:: airflow.providers.microsoft.azure.transfers.sftp_to_wasb
.. autoapi-nested-parse::
This module contains SFTP to Azure Blob Storage operator.
Module Contents
---------------
Classes
~~~~~~~
.. autoapisummary::
airflow.providers.microsoft.azure.transfers.sftp_to_wasb.SFTPToWasbOperator
Attributes
~~~~~~~~~~
.. autoapisummary::
airflow.providers.microsoft.azure.transfers.sftp_to_wasb.WILDCARD
airflow.providers.microsoft.azure.transfers.sftp_to_wasb.SftpFile
.. py:data:: WILDCARD
:annotation: = *
.. py:data:: SftpFile
.. py:class:: SFTPToWasbOperator(*, sftp_source_path, container_name, blob_prefix = '', sftp_conn_id = 'sftp_default', wasb_conn_id = 'wasb_default', load_options = None, move_object = False, wasb_overwrite_object = False, create_container = False, **kwargs)
Bases: :py:obj:`airflow.models.BaseOperator`
Transfer files to Azure Blob Storage from SFTP server.
.. seealso::
For more information on how to use this operator, take a look at the guide:
:ref:`howto/operator:SFTPToWasbOperator`
:param sftp_source_path: The sftp remote path. This is the specified file path
for downloading the single file or multiple files from the SFTP server.
You can use only one wildcard within your path. The wildcard can appear
inside the path or at the end of the path.
:param container_name: Name of the container.
:param blob_prefix: Prefix to name a blob.
:param sftp_conn_id: The sftp connection id. The name or identifier for
establishing a connection to the SFTP server.
:param wasb_conn_id: Reference to the wasb connection.
:param load_options: Optional keyword arguments that
``WasbHook.load_file()`` takes.
:param move_object: When move object is True, the object is moved instead
of copied to the new location. This is the equivalent of a mv command
as opposed to a cp command.
:param wasb_overwrite_object: Whether the blob to be uploaded
should overwrite the current data.
When wasb_overwrite_object is True, it will overwrite the existing data.
If set to False, the operation might fail with
ResourceExistsError in case a blob object already exists.
:param create_container: Attempt to create the target container prior to uploading the blob. This is
useful if the target container may not exist yet. Defaults to False.
.. py:attribute:: template_fields
:annotation: :Sequence[str] = ['sftp_source_path', 'container_name', 'blob_prefix']
.. py:method:: dry_run(self)
Performs dry run for the operator - just render template fields.
.. py:method:: execute(self, context)
Upload a file from SFTP to Azure Blob Storage.
.. py:method:: get_sftp_files_map(self)
Get SFTP files from the source path, it may use a WILDCARD to this end.
.. py:method:: get_tree_behavior(self)
Extracts from source path the tree behavior to interact with the remote folder
.. py:method:: check_wildcards_limit(self)
Check if there are multiple wildcards used in the SFTP source path.
.. py:method:: source_path_contains_wildcard(self)
:property:
Checks if the SFTP source path contains a wildcard.
.. py:method:: sftp_hook(self)
Property of sftp hook to be re-used.
.. py:method:: get_full_path_blob(self, file)
Get a blob name based on the previous name and a blob_prefix variable
.. py:method:: copy_files_to_wasb(self, sftp_files)
Upload a list of files from sftp_files to Azure Blob Storage with a new Blob Name.
.. py:method:: delete_files(self, uploaded_files)
Delete files at SFTP which have been moved to Azure Blob Storage.