# SFTP Tasks


# SftpDownload

class

prefect.tasks.sftp.sftp.SftpDownload

(host=None, username=None, password=None, port_number=None, remote_path=None, local_path=None, **kwargs)[source]

Task for downloading files from an SFTP server. Downloads remote file into sftp_downloads/ folder by default.

Args:

  • host (str): Name of the host to use.
  • username (str): Username used to authenticate.
  • password (str): Password used to authenticate.
  • port_number (int): The port to connect to the server.
  • remote_path (str): The remote SFTP file path.
  • local_path (str): The local file path to download file to.
  • **kwargs (dict, optional): Additional keyword arguments to pass to the Task constructor.
Raises:
  • ValueError: Raised if a required parameter is not supplied.
  • ClientError: Raised if exception occurs when connecting/downloading from the server.

methods:                                                                                                                                                       

prefect.tasks.sftp.sftp.SftpDownload.file_exists

(remote_path, conn)[source]

Checks if file exists in remote path or not.

Args:

  • remote_path (str): Remote file path to check if file exists.
  • conn (SFTPClient): The connection object for the SFTP server.

prefect.tasks.sftp.sftp.SftpDownload.run

(host=None, username=None, password=None, port_number=None, remote_path=None, local_path=None)[source]

Task for downloading files from an SFTP server.

Args:

  • host (str): Name of the host to use.
  • username (str): Username used to authenticate.
  • password (str): Password used to authenticate.
  • port_number (int): The port to connect to the server.
  • remote_path (str): The remote SFTP file path.
  • local_path (str): The local file path to download file to.
Raises:
  • ValueError: Raised if a required parameter is not supplied.
  • ClientError: Raised if exception occurs when connecting/downloading from the server.



# SftpUpload

class

prefect.tasks.sftp.sftp.SftpUpload

(host=None, username=None, password=None, port_number=None, remote_path=None, local_path=None, **kwargs)[source]

Task for uploading files to an SFTP server.

Args:

  • host (str): Name of the host to use.
  • username (str): Username used to authenticate.
  • password (str): Password used to authenticate.
  • port_number (int): The port number to connect to the server.
  • remote_path (str): The remote SFTP file path.
  • local_path (str): The local file path to from upload.
  • **kwargs (dict, optional): Additional keyword arguments to pass to the Task constructor.
Raises:
  • ValueError: Raised if a required parameter is not supplied.
  • ClientError: Raised if exception occurs when connecting/uploading to the server.

methods:                                                                                                                                                       

prefect.tasks.sftp.sftp.SftpUpload.run

(host=None, username=None, password=None, port_number=None, remote_path=None, local_path=None)[source]

Task for uploading files to an SFTP server.

Args:

  • host (str): Name of the host to use.
  • username (str): Username used to authenticate.
  • password (str): Password used to authenticate.
  • port_number (int): The port number to connect to the server.
  • remote_path (str): The remote SFTP file path.
  • local_path (str): The local file path to upload from.
Raises:
  • ValueError: Raised if a required parameter is not supplied.
  • ClientError: Raised if exception occurs when connecting/uploading from the server.



This documentation was auto-generated from commit ffa9a6c
on February 1, 2023 at 18:44 UTC