Samba connection¶
Bases: FileConnection
Based on pysmb library.
Added in 0.9.4
Warning
To use Samba connector you should install package as follows:
pip install "onetl[samba]"
# or
pip install "onetl[files]"
Parameters:
-
host(str) –Host of Samba source. For example:
mydomain.com. -
share(str) –The name of the share on the Samba server.
-
protocol(str, default:SMB) –The protocol to use for the connection. Either
SMBorNetBIOS. Affects the default port and theis_direct_tcpflag inSMBConnection. -
port(int, default:445) –Port of Samba source.
-
domain(str, default:`) –Domain name for the Samba connection. Empty strings means use
hostas domain name. -
auth_type(str, default:NTLMv2) –The authentication type to use. Either
NTLMv2orNTLMv1``. Affects theuse_ntlm_v2flag inSMBConnection`. -
user(str, default:None) –User, which have access to the file source. Can be
Nonefor anonymous connection. -
password(str, default:None) –Password for file source connection. Can be
Nonefor anonymous connection.
Examples:
Create and check Samba connection:
from onetl.connection import Samba
samba = Samba(
host="mydomain.com",
share="share_name",
protocol="SMB",
port=445,
user="user",
password="password",
).check()
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