Skip to content

FTP connection

FTP

FTP file connection. support hooks

Based on FTPUtil library.

Warning

Since onETL v0.7.0 to use FTP connector you should install package as follows:

pip install "onetl[ftp]"

# or
pip install "onetl[files]"
See DBR-onetl-install-files-file-connections installation instruction for more details.

Added in 0.1.0

Parameters:

  • host

    (str) –

    Host of FTP source. For example: ftp.domain.com

  • port

    (int, default: 21 ) –

    Port of FTP source

  • user

    (str | None, default: None ) –

    User, which have access to the file source. For example: someuser.

    None means that the user is anonymous.

  • password

    (SecretStr | None, default: None ) –

    Password for file source connection.

    None means that the user is anonymous.

  • extra

    (FTPExtra, default: <dynamic> ) –

    Extra options

Examples:

from onetl.connection import FTP

ftp = FTP(
    host="ftp.domain.com",
    user="someuser",
    password="*****",
).check()
from onetl.connection import FTP

ftp = FTP(
    host="ftp.domain.com",
    user="someuser",
    password="*****",
    extra=FTP.Extra(use_passive_mode=True),
).check()

path_exists(path)

FTPExtra

Extra options for FTP connection.

You can pass here any parameters supported by ftputil.session.session_factory.

Added in 0.16.0

Parameters:

  • use_passive_mode

    (bool | None, default: None ) –

    Set to True to use passive mode, False to use active mode, None for autodetect

  • encoding

    (str, default: 'utf-8' ) –

    File path encoding