SFTP connection¶
Bases: FileConnection, RenameDirMixin
Based on Paramiko library.
Warning
Since onETL v0.7.0 to use SFTP connector you should install package as follows:
pip install "onetl[s3]"
# or
pip install "onetl[files]"
Added in 0.1.0
Parameters:
-
host(str) –Host of SFTP source. For example:
192.168.1.19 -
port(int, default:22) –Port of SFTP source
-
user(str) –User, which have access to the file source. For example:
someuser -
password(str, default:None) –Password for file source connection
-
key_file(str, default:None) –the filename of optional private key(s) and/or certs to try for authentication
-
timeout(int, default:10) –How long to wait for the server to send data before giving up
-
host_key_check(bool, default:False) –set to True to enable searching for discoverable private key files in
~/.ssh/ -
compress(bool, default:True) –Set to True to turn on compression
Examples:
Create and check SFTP connection:
from onetl.connection import SFTP
sftp = SFTP(
host="192.168.1.19",
user="someuser",
password="*****",
).check()
path_exists(path)
¶
Check if specified path exists on remote filesystem. .
Added in 0.8.0
Parameters:
-
path(str | PathLike) –Path to check
Returns:
-
bool–Trueif path exists,Falseotherwise.
Examples:
>>> connection.path_exists("/path/to/file.csv")
True
>>> connection.path_exists("/path/to/dir")
True
>>> connection.path_exists("/path/to/missing")
False