astronomer.providers.sftp.hooks.sftp

Module Contents

Classes

SFTPHookAsync

This class is deprecated and will be removed in 2.0.0.

class astronomer.providers.sftp.hooks.sftp.SFTPHookAsync(sftp_conn_id=default_conn_name, host='', port=22, username='', password='', known_hosts=default_known_hosts, key_file='', passphrase='', private_key='')[source]

Bases: airflow.hooks.base.BaseHook

This class is deprecated and will be removed in 2.0.0. Use :class: ~airflow.providers.sftp.hooks.sftp.SFTPHookAsync instead.

conn_name_attr = 'ssh_conn_id'
default_conn_name = 'sftp_default'
conn_type = 'sftp'
hook_name = 'SFTP'
default_known_hosts = '~/.ssh/known_hosts'
async list_directory(path='')[source]

Returns a list of files on the SFTP server at the provided path

async read_directory(path='')[source]

Returns a list of files along with their attributes on the SFTP server at the provided path

async get_files_and_attrs_by_pattern(path='', fnmatch_pattern='')[source]

Returns the files along with their attributes matching the file pattern (e.g. *.pdf) at the provided path, if one exists. Otherwise, raises an AirflowException to be handled upstream for deferring

async get_files_by_pattern(path='', fnmatch_pattern='')[source]

Returns the name of a file matching the file pattern at the provided path, if one exists Otherwise, raises an AirflowException to be handled upstream for deferring

async get_mod_time(path)[source]

Makes SFTP async connection and looks for last modified time in the specific file path and returns last modification time for the file path.

Parameters:

path (str) – full path to the remote file