apache-airflow-providers-sftp 4.11.1rc1__tar.gz → 5.0.0rc1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {apache_airflow_providers_sftp-4.11.1rc1 → apache_airflow_providers_sftp-5.0.0rc1}/PKG-INFO +14 -17
- {apache_airflow_providers_sftp-4.11.1rc1 → apache_airflow_providers_sftp-5.0.0rc1}/README.rst +5 -5
- {apache_airflow_providers_sftp-4.11.1rc1 → apache_airflow_providers_sftp-5.0.0rc1}/airflow/providers/sftp/__init__.py +3 -3
- {apache_airflow_providers_sftp-4.11.1rc1 → apache_airflow_providers_sftp-5.0.0rc1}/airflow/providers/sftp/decorators/sensors/sftp.py +2 -1
- {apache_airflow_providers_sftp-4.11.1rc1 → apache_airflow_providers_sftp-5.0.0rc1}/airflow/providers/sftp/get_provider_info.py +3 -2
- {apache_airflow_providers_sftp-4.11.1rc1 → apache_airflow_providers_sftp-5.0.0rc1}/airflow/providers/sftp/hooks/sftp.py +21 -43
- {apache_airflow_providers_sftp-4.11.1rc1 → apache_airflow_providers_sftp-5.0.0rc1}/airflow/providers/sftp/operators/sftp.py +8 -38
- {apache_airflow_providers_sftp-4.11.1rc1 → apache_airflow_providers_sftp-5.0.0rc1}/airflow/providers/sftp/sensors/sftp.py +2 -1
- {apache_airflow_providers_sftp-4.11.1rc1 → apache_airflow_providers_sftp-5.0.0rc1}/airflow/providers/sftp/triggers/sftp.py +2 -1
- {apache_airflow_providers_sftp-4.11.1rc1 → apache_airflow_providers_sftp-5.0.0rc1}/pyproject.toml +7 -12
- {apache_airflow_providers_sftp-4.11.1rc1 → apache_airflow_providers_sftp-5.0.0rc1}/airflow/providers/sftp/LICENSE +0 -0
- {apache_airflow_providers_sftp-4.11.1rc1 → apache_airflow_providers_sftp-5.0.0rc1}/airflow/providers/sftp/decorators/__init__.py +0 -0
- {apache_airflow_providers_sftp-4.11.1rc1 → apache_airflow_providers_sftp-5.0.0rc1}/airflow/providers/sftp/decorators/sensors/__init__.py +0 -0
- {apache_airflow_providers_sftp-4.11.1rc1 → apache_airflow_providers_sftp-5.0.0rc1}/airflow/providers/sftp/hooks/__init__.py +0 -0
- {apache_airflow_providers_sftp-4.11.1rc1 → apache_airflow_providers_sftp-5.0.0rc1}/airflow/providers/sftp/operators/__init__.py +0 -0
- {apache_airflow_providers_sftp-4.11.1rc1 → apache_airflow_providers_sftp-5.0.0rc1}/airflow/providers/sftp/sensors/__init__.py +0 -0
- {apache_airflow_providers_sftp-4.11.1rc1 → apache_airflow_providers_sftp-5.0.0rc1}/airflow/providers/sftp/triggers/__init__.py +0 -0
@@ -1,11 +1,11 @@
|
|
1
|
-
Metadata-Version: 2.
|
1
|
+
Metadata-Version: 2.3
|
2
2
|
Name: apache-airflow-providers-sftp
|
3
|
-
Version:
|
3
|
+
Version: 5.0.0rc1
|
4
4
|
Summary: Provider package apache-airflow-providers-sftp for Apache Airflow
|
5
5
|
Keywords: airflow-provider,sftp,airflow,integration
|
6
6
|
Author-email: Apache Software Foundation <dev@airflow.apache.org>
|
7
7
|
Maintainer-email: Apache Software Foundation <dev@airflow.apache.org>
|
8
|
-
Requires-Python: ~=3.
|
8
|
+
Requires-Python: ~=3.9
|
9
9
|
Description-Content-Type: text/x-rst
|
10
10
|
Classifier: Development Status :: 5 - Production/Stable
|
11
11
|
Classifier: Environment :: Console
|
@@ -15,29 +15,26 @@ Classifier: Intended Audience :: System Administrators
|
|
15
15
|
Classifier: Framework :: Apache Airflow
|
16
16
|
Classifier: Framework :: Apache Airflow :: Provider
|
17
17
|
Classifier: License :: OSI Approved :: Apache Software License
|
18
|
-
Classifier: Programming Language :: Python :: 3.8
|
19
18
|
Classifier: Programming Language :: Python :: 3.9
|
20
19
|
Classifier: Programming Language :: Python :: 3.10
|
21
20
|
Classifier: Programming Language :: Python :: 3.11
|
22
21
|
Classifier: Programming Language :: Python :: 3.12
|
23
22
|
Classifier: Topic :: System :: Monitoring
|
24
23
|
Requires-Dist: apache-airflow-providers-ssh>=2.1.0rc0
|
25
|
-
Requires-Dist: apache-airflow>=2.
|
24
|
+
Requires-Dist: apache-airflow>=2.9.0rc0
|
26
25
|
Requires-Dist: asyncssh>=2.12.0
|
27
26
|
Requires-Dist: paramiko>=2.9.0
|
28
|
-
Requires-Dist: apache-airflow-providers-common-compat ; extra == "common
|
27
|
+
Requires-Dist: apache-airflow-providers-common-compat ; extra == "common-compat"
|
29
28
|
Requires-Dist: apache-airflow-providers-openlineage ; extra == "openlineage"
|
30
|
-
Requires-Dist: apache-airflow-providers-ssh ; extra == "ssh"
|
31
29
|
Project-URL: Bug Tracker, https://github.com/apache/airflow/issues
|
32
|
-
Project-URL: Changelog, https://airflow.apache.org/docs/apache-airflow-providers-sftp/
|
33
|
-
Project-URL: Documentation, https://airflow.apache.org/docs/apache-airflow-providers-sftp/
|
30
|
+
Project-URL: Changelog, https://airflow.apache.org/docs/apache-airflow-providers-sftp/5.0.0/changelog.html
|
31
|
+
Project-URL: Documentation, https://airflow.apache.org/docs/apache-airflow-providers-sftp/5.0.0
|
34
32
|
Project-URL: Slack Chat, https://s.apache.org/airflow-slack
|
35
33
|
Project-URL: Source Code, https://github.com/apache/airflow
|
36
|
-
Project-URL: Twitter, https://
|
34
|
+
Project-URL: Twitter, https://x.com/ApacheAirflow
|
37
35
|
Project-URL: YouTube, https://www.youtube.com/channel/UCSXwxpWZQ7XZ1WL3wqevChA/
|
38
|
-
Provides-Extra: common
|
36
|
+
Provides-Extra: common-compat
|
39
37
|
Provides-Extra: openlineage
|
40
|
-
Provides-Extra: ssh
|
41
38
|
|
42
39
|
|
43
40
|
.. Licensed to the Apache Software Foundation (ASF) under one
|
@@ -83,7 +80,7 @@ Provides-Extra: ssh
|
|
83
80
|
|
84
81
|
Package ``apache-airflow-providers-sftp``
|
85
82
|
|
86
|
-
Release: ``
|
83
|
+
Release: ``5.0.0.rc1``
|
87
84
|
|
88
85
|
|
89
86
|
`SSH File Transfer Protocol (SFTP) <https://tools.ietf.org/wg/secsh/draft-ietf-secsh-filexfer/>`__
|
@@ -96,7 +93,7 @@ This is a provider package for ``sftp`` provider. All classes for this provider
|
|
96
93
|
are in ``airflow.providers.sftp`` python package.
|
97
94
|
|
98
95
|
You can find package information and changelog for the provider
|
99
|
-
in the `documentation <https://airflow.apache.org/docs/apache-airflow-providers-sftp/
|
96
|
+
in the `documentation <https://airflow.apache.org/docs/apache-airflow-providers-sftp/5.0.0/>`_.
|
100
97
|
|
101
98
|
Installation
|
102
99
|
------------
|
@@ -105,7 +102,7 @@ You can install this package on top of an existing Airflow 2 installation (see `
|
|
105
102
|
for the minimum Airflow version supported) via
|
106
103
|
``pip install apache-airflow-providers-sftp``
|
107
104
|
|
108
|
-
The package supports the following python versions: 3.
|
105
|
+
The package supports the following python versions: 3.9,3.10,3.11,3.12
|
109
106
|
|
110
107
|
Requirements
|
111
108
|
------------
|
@@ -113,7 +110,7 @@ Requirements
|
|
113
110
|
================================ ==================
|
114
111
|
PIP package Version required
|
115
112
|
================================ ==================
|
116
|
-
``apache-airflow`` ``>=2.
|
113
|
+
``apache-airflow`` ``>=2.9.0``
|
117
114
|
``apache-airflow-providers-ssh`` ``>=2.1.0``
|
118
115
|
``paramiko`` ``>=2.9.0``
|
119
116
|
``asyncssh`` ``>=2.12.0``
|
@@ -141,4 +138,4 @@ Dependent package
|
|
141
138
|
================================================================================================================== =================
|
142
139
|
|
143
140
|
The changelog for the provider package can be found in the
|
144
|
-
`changelog <https://airflow.apache.org/docs/apache-airflow-providers-sftp/
|
141
|
+
`changelog <https://airflow.apache.org/docs/apache-airflow-providers-sftp/5.0.0/changelog.html>`_.
|
{apache_airflow_providers_sftp-4.11.1rc1 → apache_airflow_providers_sftp-5.0.0rc1}/README.rst
RENAMED
@@ -42,7 +42,7 @@
|
|
42
42
|
|
43
43
|
Package ``apache-airflow-providers-sftp``
|
44
44
|
|
45
|
-
Release: ``
|
45
|
+
Release: ``5.0.0.rc1``
|
46
46
|
|
47
47
|
|
48
48
|
`SSH File Transfer Protocol (SFTP) <https://tools.ietf.org/wg/secsh/draft-ietf-secsh-filexfer/>`__
|
@@ -55,7 +55,7 @@ This is a provider package for ``sftp`` provider. All classes for this provider
|
|
55
55
|
are in ``airflow.providers.sftp`` python package.
|
56
56
|
|
57
57
|
You can find package information and changelog for the provider
|
58
|
-
in the `documentation <https://airflow.apache.org/docs/apache-airflow-providers-sftp/
|
58
|
+
in the `documentation <https://airflow.apache.org/docs/apache-airflow-providers-sftp/5.0.0/>`_.
|
59
59
|
|
60
60
|
Installation
|
61
61
|
------------
|
@@ -64,7 +64,7 @@ You can install this package on top of an existing Airflow 2 installation (see `
|
|
64
64
|
for the minimum Airflow version supported) via
|
65
65
|
``pip install apache-airflow-providers-sftp``
|
66
66
|
|
67
|
-
The package supports the following python versions: 3.
|
67
|
+
The package supports the following python versions: 3.9,3.10,3.11,3.12
|
68
68
|
|
69
69
|
Requirements
|
70
70
|
------------
|
@@ -72,7 +72,7 @@ Requirements
|
|
72
72
|
================================ ==================
|
73
73
|
PIP package Version required
|
74
74
|
================================ ==================
|
75
|
-
``apache-airflow`` ``>=2.
|
75
|
+
``apache-airflow`` ``>=2.9.0``
|
76
76
|
``apache-airflow-providers-ssh`` ``>=2.1.0``
|
77
77
|
``paramiko`` ``>=2.9.0``
|
78
78
|
``asyncssh`` ``>=2.12.0``
|
@@ -100,4 +100,4 @@ Dependent package
|
|
100
100
|
================================================================================================================== =================
|
101
101
|
|
102
102
|
The changelog for the provider package can be found in the
|
103
|
-
`changelog <https://airflow.apache.org/docs/apache-airflow-providers-sftp/
|
103
|
+
`changelog <https://airflow.apache.org/docs/apache-airflow-providers-sftp/5.0.0/changelog.html>`_.
|
@@ -29,11 +29,11 @@ from airflow import __version__ as airflow_version
|
|
29
29
|
|
30
30
|
__all__ = ["__version__"]
|
31
31
|
|
32
|
-
__version__ = "
|
32
|
+
__version__ = "5.0.0"
|
33
33
|
|
34
34
|
if packaging.version.parse(packaging.version.parse(airflow_version).base_version) < packaging.version.parse(
|
35
|
-
"2.
|
35
|
+
"2.9.0"
|
36
36
|
):
|
37
37
|
raise RuntimeError(
|
38
|
-
f"The package `apache-airflow-providers-sftp:{__version__}` needs Apache Airflow 2.
|
38
|
+
f"The package `apache-airflow-providers-sftp:{__version__}` needs Apache Airflow 2.9.0+"
|
39
39
|
)
|
@@ -17,7 +17,8 @@
|
|
17
17
|
|
18
18
|
from __future__ import annotations
|
19
19
|
|
20
|
-
from
|
20
|
+
from collections.abc import Sequence
|
21
|
+
from typing import Callable
|
21
22
|
|
22
23
|
from airflow.decorators.base import TaskDecorator, get_unique_task_id, task_decorator_factory
|
23
24
|
from airflow.providers.sftp.sensors.sftp import SFTPSensor
|
@@ -28,8 +28,9 @@ def get_provider_info():
|
|
28
28
|
"name": "SFTP",
|
29
29
|
"description": "`SSH File Transfer Protocol (SFTP) <https://tools.ietf.org/wg/secsh/draft-ietf-secsh-filexfer/>`__\n",
|
30
30
|
"state": "ready",
|
31
|
-
"source-date-epoch":
|
31
|
+
"source-date-epoch": 1734536539,
|
32
32
|
"versions": [
|
33
|
+
"5.0.0",
|
33
34
|
"4.11.1",
|
34
35
|
"4.11.0",
|
35
36
|
"4.10.3",
|
@@ -72,7 +73,7 @@ def get_provider_info():
|
|
72
73
|
"1.0.0",
|
73
74
|
],
|
74
75
|
"dependencies": [
|
75
|
-
"apache-airflow>=2.
|
76
|
+
"apache-airflow>=2.9.0",
|
76
77
|
"apache-airflow-providers-ssh>=2.1.0",
|
77
78
|
"paramiko>=2.9.0",
|
78
79
|
"asyncssh>=2.12.0",
|
@@ -22,14 +22,14 @@ from __future__ import annotations
|
|
22
22
|
import datetime
|
23
23
|
import os
|
24
24
|
import stat
|
25
|
-
import
|
25
|
+
from collections.abc import Sequence
|
26
26
|
from fnmatch import fnmatch
|
27
|
-
from typing import TYPE_CHECKING, Any, Callable
|
27
|
+
from typing import TYPE_CHECKING, Any, Callable
|
28
28
|
|
29
29
|
import asyncssh
|
30
30
|
from asgiref.sync import sync_to_async
|
31
31
|
|
32
|
-
from airflow.exceptions import AirflowException
|
32
|
+
from airflow.exceptions import AirflowException
|
33
33
|
from airflow.hooks.base import BaseHook
|
34
34
|
from airflow.providers.ssh.hooks.ssh import SSHHook
|
35
35
|
|
@@ -61,7 +61,6 @@ class SFTPHook(SSHHook):
|
|
61
61
|
For consistency reasons with SSHHook, the preferred parameter is "ssh_conn_id".
|
62
62
|
|
63
63
|
:param ssh_conn_id: The :ref:`sftp connection id<howto/connection:sftp>`
|
64
|
-
:param ssh_hook: Optional SSH hook (included to support passing of an SSH hook to the SFTP operator)
|
65
64
|
"""
|
66
65
|
|
67
66
|
conn_name_attr = "ssh_conn_id"
|
@@ -81,39 +80,14 @@ class SFTPHook(SSHHook):
|
|
81
80
|
def __init__(
|
82
81
|
self,
|
83
82
|
ssh_conn_id: str | None = "sftp_default",
|
84
|
-
|
83
|
+
host_proxy_cmd: str | None = None,
|
85
84
|
*args,
|
86
85
|
**kwargs,
|
87
86
|
) -> None:
|
88
87
|
self.conn: paramiko.SFTPClient | None = None
|
89
88
|
|
90
|
-
# TODO: remove support for ssh_hook when it is removed from SFTPOperator
|
91
|
-
self.ssh_hook = ssh_hook
|
92
|
-
|
93
|
-
if self.ssh_hook is not None:
|
94
|
-
warnings.warn(
|
95
|
-
"Parameter `ssh_hook` is deprecated and will be removed in a future version.",
|
96
|
-
AirflowProviderDeprecationWarning,
|
97
|
-
stacklevel=2,
|
98
|
-
)
|
99
|
-
if not isinstance(self.ssh_hook, SSHHook):
|
100
|
-
raise AirflowException(
|
101
|
-
f"ssh_hook must be an instance of SSHHook, but got {type(self.ssh_hook)}"
|
102
|
-
)
|
103
|
-
self.log.info("ssh_hook is provided. It will be used to generate SFTP connection.")
|
104
|
-
self.ssh_conn_id = self.ssh_hook.ssh_conn_id
|
105
|
-
return
|
106
|
-
|
107
|
-
ftp_conn_id = kwargs.pop("ftp_conn_id", None)
|
108
|
-
if ftp_conn_id:
|
109
|
-
warnings.warn(
|
110
|
-
"Parameter `ftp_conn_id` is deprecated. Please use `ssh_conn_id` instead.",
|
111
|
-
AirflowProviderDeprecationWarning,
|
112
|
-
stacklevel=2,
|
113
|
-
)
|
114
|
-
ssh_conn_id = ftp_conn_id
|
115
|
-
|
116
89
|
kwargs["ssh_conn_id"] = ssh_conn_id
|
90
|
+
kwargs["host_proxy_cmd"] = host_proxy_cmd
|
117
91
|
self.ssh_conn_id = ssh_conn_id
|
118
92
|
|
119
93
|
super().__init__(*args, **kwargs)
|
@@ -121,11 +95,7 @@ class SFTPHook(SSHHook):
|
|
121
95
|
def get_conn(self) -> paramiko.SFTPClient: # type: ignore[override]
|
122
96
|
"""Open an SFTP connection to the remote host."""
|
123
97
|
if self.conn is None:
|
124
|
-
|
125
|
-
if self.ssh_hook is not None:
|
126
|
-
self.conn = self.ssh_hook.get_conn().open_sftp()
|
127
|
-
else:
|
128
|
-
self.conn = super().get_conn().open_sftp()
|
98
|
+
self.conn = super().get_conn().open_sftp()
|
129
99
|
return self.conn
|
130
100
|
|
131
101
|
def close_conn(self) -> None:
|
@@ -165,6 +135,15 @@ class SFTPHook(SSHHook):
|
|
165
135
|
files = sorted(conn.listdir(path))
|
166
136
|
return files
|
167
137
|
|
138
|
+
def list_directory_with_attr(self, path: str) -> list[paramiko.SFTPAttributes]:
|
139
|
+
"""
|
140
|
+
List files in a directory on the remote system including their SFTPAttributes.
|
141
|
+
|
142
|
+
:param path: full path to the remote directory to list
|
143
|
+
"""
|
144
|
+
conn = self.get_conn()
|
145
|
+
return [file for file in conn.listdir_attr(path)]
|
146
|
+
|
168
147
|
def mkdir(self, path: str, mode: int = 0o777) -> None:
|
169
148
|
"""
|
170
149
|
Create a directory on the remote system.
|
@@ -341,10 +320,9 @@ class SFTPHook(SSHHook):
|
|
341
320
|
(form: ``func(str)``)
|
342
321
|
:param bool recurse: *Default: True* - should it recurse
|
343
322
|
"""
|
344
|
-
|
345
|
-
|
346
|
-
|
347
|
-
mode = conn.stat(pathname).st_mode
|
323
|
+
for entry in self.list_directory_with_attr(path):
|
324
|
+
pathname = os.path.join(path, entry.filename)
|
325
|
+
mode = entry.st_mode
|
348
326
|
if stat.S_ISDIR(mode): # type: ignore
|
349
327
|
# It's a directory, call the dcallback function
|
350
328
|
dcallback(pathname)
|
@@ -420,9 +398,9 @@ class SFTPHook(SSHHook):
|
|
420
398
|
:return: list of string containing the found files, or an empty list if none matched
|
421
399
|
"""
|
422
400
|
matched_files = []
|
423
|
-
for file in self.
|
424
|
-
if fnmatch(file, fnmatch_pattern):
|
425
|
-
matched_files.append(file)
|
401
|
+
for file in self.list_directory_with_attr(path):
|
402
|
+
if fnmatch(file.filename, fnmatch_pattern):
|
403
|
+
matched_files.append(file.filename)
|
426
404
|
|
427
405
|
return matched_files
|
428
406
|
|
@@ -21,16 +21,15 @@ from __future__ import annotations
|
|
21
21
|
|
22
22
|
import os
|
23
23
|
import socket
|
24
|
-
import
|
24
|
+
from collections.abc import Sequence
|
25
25
|
from pathlib import Path
|
26
|
-
from typing import Any
|
26
|
+
from typing import Any
|
27
27
|
|
28
28
|
import paramiko
|
29
29
|
|
30
|
-
from airflow.exceptions import AirflowException
|
30
|
+
from airflow.exceptions import AirflowException
|
31
31
|
from airflow.models import BaseOperator
|
32
32
|
from airflow.providers.sftp.hooks.sftp import SFTPHook
|
33
|
-
from airflow.providers.ssh.hooks.ssh import SSHHook
|
34
33
|
|
35
34
|
|
36
35
|
class SFTPOperation:
|
@@ -47,15 +46,12 @@ class SFTPOperator(BaseOperator):
|
|
47
46
|
This operator uses sftp_hook to open sftp transport channel that serve as basis for file transfer.
|
48
47
|
|
49
48
|
:param ssh_conn_id: :ref:`ssh connection id<howto/connection:ssh>`
|
50
|
-
from airflow Connections.
|
51
|
-
or `sftp_hook` is provided.
|
49
|
+
from airflow Connections.
|
52
50
|
:param sftp_hook: predefined SFTPHook to use
|
53
51
|
Either `sftp_hook` or `ssh_conn_id` needs to be provided.
|
54
|
-
:param ssh_hook: Deprecated - predefined SSHHook to use for remote execution
|
55
|
-
Use `sftp_hook` instead.
|
56
52
|
:param remote_host: remote host to connect (templated)
|
57
53
|
Nullable. If provided, it will replace the `remote_host` which was
|
58
|
-
defined in `sftp_hook
|
54
|
+
defined in `sftp_hook` or predefined in the connection of `ssh_conn_id`.
|
59
55
|
:param local_filepath: local file path or list of local file paths to get or put. (templated)
|
60
56
|
:param remote_filepath: remote file path or list of remote file paths to get or put. (templated)
|
61
57
|
:param operation: specify operation 'get' or 'put', defaults to put
|
@@ -85,7 +81,6 @@ class SFTPOperator(BaseOperator):
|
|
85
81
|
def __init__(
|
86
82
|
self,
|
87
83
|
*,
|
88
|
-
ssh_hook: SSHHook | None = None,
|
89
84
|
sftp_hook: SFTPHook | None = None,
|
90
85
|
ssh_conn_id: str | None = None,
|
91
86
|
remote_host: str | None = None,
|
@@ -97,7 +92,6 @@ class SFTPOperator(BaseOperator):
|
|
97
92
|
**kwargs,
|
98
93
|
) -> None:
|
99
94
|
super().__init__(**kwargs)
|
100
|
-
self.ssh_hook = ssh_hook
|
101
95
|
self.sftp_hook = sftp_hook
|
102
96
|
self.ssh_conn_id = ssh_conn_id
|
103
97
|
self.remote_host = remote_host
|
@@ -130,35 +124,13 @@ class SFTPOperator(BaseOperator):
|
|
130
124
|
f"expected {SFTPOperation.GET} or {SFTPOperation.PUT}."
|
131
125
|
)
|
132
126
|
|
133
|
-
# TODO: remove support for ssh_hook in next major provider version in hook and operator
|
134
|
-
if self.ssh_hook is not None and self.sftp_hook is not None:
|
135
|
-
raise AirflowException(
|
136
|
-
"Both `ssh_hook` and `sftp_hook` are defined. Please use only one of them."
|
137
|
-
)
|
138
|
-
|
139
|
-
if self.ssh_hook is not None:
|
140
|
-
if not isinstance(self.ssh_hook, SSHHook):
|
141
|
-
self.log.info("ssh_hook is invalid. Trying ssh_conn_id to create SFTPHook.")
|
142
|
-
self.sftp_hook = SFTPHook(ssh_conn_id=self.ssh_conn_id)
|
143
|
-
if self.sftp_hook is None:
|
144
|
-
warnings.warn(
|
145
|
-
"Parameter `ssh_hook` is deprecated. "
|
146
|
-
"Please use `sftp_hook` instead. "
|
147
|
-
"The old parameter `ssh_hook` will be removed in a future version.",
|
148
|
-
AirflowProviderDeprecationWarning,
|
149
|
-
stacklevel=2,
|
150
|
-
)
|
151
|
-
self.sftp_hook = SFTPHook(ssh_hook=self.ssh_hook)
|
152
|
-
|
153
127
|
file_msg = None
|
154
128
|
try:
|
155
129
|
if self.ssh_conn_id:
|
156
130
|
if self.sftp_hook and isinstance(self.sftp_hook, SFTPHook):
|
157
|
-
self.log.info("ssh_conn_id is ignored when sftp_hook
|
131
|
+
self.log.info("ssh_conn_id is ignored when sftp_hook is provided.")
|
158
132
|
else:
|
159
|
-
self.log.info(
|
160
|
-
"sftp_hook/ssh_hook not provided or invalid. Trying ssh_conn_id to create SFTPHook."
|
161
|
-
)
|
133
|
+
self.log.info("sftp_hook not provided or invalid. Trying ssh_conn_id to create SFTPHook.")
|
162
134
|
self.sftp_hook = SFTPHook(ssh_conn_id=self.ssh_conn_id)
|
163
135
|
|
164
136
|
if not self.sftp_hook:
|
@@ -216,7 +188,7 @@ class SFTPOperator(BaseOperator):
|
|
216
188
|
exc_info=True,
|
217
189
|
)
|
218
190
|
|
219
|
-
hook = self.sftp_hook or
|
191
|
+
hook = self.sftp_hook or SFTPHook(ssh_conn_id=self.ssh_conn_id)
|
220
192
|
|
221
193
|
if self.remote_host is not None:
|
222
194
|
remote_host = self.remote_host
|
@@ -234,8 +206,6 @@ class SFTPOperator(BaseOperator):
|
|
234
206
|
|
235
207
|
if hasattr(hook, "port"):
|
236
208
|
remote_port = hook.port
|
237
|
-
elif hasattr(hook, "ssh_hook"):
|
238
|
-
remote_port = hook.ssh_hook.port
|
239
209
|
|
240
210
|
# Since v4.1.0, SFTPOperator accepts both a string (single file) and a list of
|
241
211
|
# strings (multiple files) as local_filepath and remote_filepath, and internally
|
@@ -20,8 +20,9 @@
|
|
20
20
|
from __future__ import annotations
|
21
21
|
|
22
22
|
import os
|
23
|
+
from collections.abc import Sequence
|
23
24
|
from datetime import datetime, timedelta
|
24
|
-
from typing import TYPE_CHECKING, Any, Callable
|
25
|
+
from typing import TYPE_CHECKING, Any, Callable
|
25
26
|
|
26
27
|
from paramiko.sftp import SFTP_NO_SUCH_FILE
|
27
28
|
|
@@ -18,8 +18,9 @@
|
|
18
18
|
from __future__ import annotations
|
19
19
|
|
20
20
|
import asyncio
|
21
|
+
from collections.abc import AsyncIterator
|
21
22
|
from datetime import datetime
|
22
|
-
from typing import Any
|
23
|
+
from typing import Any
|
23
24
|
|
24
25
|
from dateutil.parser import parse as parse_date
|
25
26
|
|
{apache_airflow_providers_sftp-4.11.1rc1 → apache_airflow_providers_sftp-5.0.0rc1}/pyproject.toml
RENAMED
@@ -21,14 +21,13 @@
|
|
21
21
|
|
22
22
|
# IF YOU WANT TO MODIFY THIS FILE, YOU SHOULD MODIFY THE TEMPLATE
|
23
23
|
# `pyproject_TEMPLATE.toml.jinja2` IN the `dev/breeze/src/airflow_breeze/templates` DIRECTORY
|
24
|
-
#
|
25
24
|
[build-system]
|
26
|
-
requires = ["flit_core
|
25
|
+
requires = ["flit_core==3.10.1"]
|
27
26
|
build-backend = "flit_core.buildapi"
|
28
27
|
|
29
28
|
[project]
|
30
29
|
name = "apache-airflow-providers-sftp"
|
31
|
-
version = "
|
30
|
+
version = "5.0.0.rc1"
|
32
31
|
description = "Provider package apache-airflow-providers-sftp for Apache Airflow"
|
33
32
|
readme = "README.rst"
|
34
33
|
authors = [
|
@@ -47,28 +46,27 @@ classifiers = [
|
|
47
46
|
"Framework :: Apache Airflow",
|
48
47
|
"Framework :: Apache Airflow :: Provider",
|
49
48
|
"License :: OSI Approved :: Apache Software License",
|
50
|
-
"Programming Language :: Python :: 3.8",
|
51
49
|
"Programming Language :: Python :: 3.9",
|
52
50
|
"Programming Language :: Python :: 3.10",
|
53
51
|
"Programming Language :: Python :: 3.11",
|
54
52
|
"Programming Language :: Python :: 3.12",
|
55
53
|
"Topic :: System :: Monitoring",
|
56
54
|
]
|
57
|
-
requires-python = "~=3.
|
55
|
+
requires-python = "~=3.9"
|
58
56
|
dependencies = [
|
59
57
|
"apache-airflow-providers-ssh>=2.1.0rc0",
|
60
|
-
"apache-airflow>=2.
|
58
|
+
"apache-airflow>=2.9.0rc0",
|
61
59
|
"asyncssh>=2.12.0",
|
62
60
|
"paramiko>=2.9.0",
|
63
61
|
]
|
64
62
|
|
65
63
|
[project.urls]
|
66
|
-
"Documentation" = "https://airflow.apache.org/docs/apache-airflow-providers-sftp/
|
67
|
-
"Changelog" = "https://airflow.apache.org/docs/apache-airflow-providers-sftp/
|
64
|
+
"Documentation" = "https://airflow.apache.org/docs/apache-airflow-providers-sftp/5.0.0"
|
65
|
+
"Changelog" = "https://airflow.apache.org/docs/apache-airflow-providers-sftp/5.0.0/changelog.html"
|
68
66
|
"Bug Tracker" = "https://github.com/apache/airflow/issues"
|
69
67
|
"Source Code" = "https://github.com/apache/airflow"
|
70
68
|
"Slack Chat" = "https://s.apache.org/airflow-slack"
|
71
|
-
"Twitter" = "https://
|
69
|
+
"Twitter" = "https://x.com/ApacheAirflow"
|
72
70
|
"YouTube" = "https://www.youtube.com/channel/UCSXwxpWZQ7XZ1WL3wqevChA/"
|
73
71
|
|
74
72
|
[project.entry-points."apache_airflow_provider"]
|
@@ -80,9 +78,6 @@ provider_info = "airflow.providers.sftp.get_provider_info:get_provider_info"
|
|
80
78
|
"openlineage" = [
|
81
79
|
"apache-airflow-providers-openlineage",
|
82
80
|
]
|
83
|
-
"ssh" = [
|
84
|
-
"apache-airflow-providers-ssh",
|
85
|
-
]
|
86
81
|
|
87
82
|
[tool.flit.module]
|
88
83
|
name = "airflow.providers.sftp"
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|