apache-airflow-providers-common-sql 1.13.0__py3-none-any.whl → 1.14.0__py3-none-any.whl
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.
- airflow/providers/common/sql/__init__.py +3 -6
- airflow/providers/common/sql/get_provider_info.py +2 -1
- airflow/providers/common/sql/hooks/sql.py +9 -15
- airflow/providers/common/sql/sensors/sql.py +21 -21
- airflow/providers/common/sql/sensors/sql.pyi +9 -8
- {apache_airflow_providers_common_sql-1.13.0.dist-info → apache_airflow_providers_common_sql-1.14.0.dist-info}/METADATA +6 -6
- {apache_airflow_providers_common_sql-1.13.0.dist-info → apache_airflow_providers_common_sql-1.14.0.dist-info}/RECORD +9 -9
- {apache_airflow_providers_common_sql-1.13.0.dist-info → apache_airflow_providers_common_sql-1.14.0.dist-info}/WHEEL +0 -0
- {apache_airflow_providers_common_sql-1.13.0.dist-info → apache_airflow_providers_common_sql-1.14.0.dist-info}/entry_points.txt +0 -0
|
@@ -25,14 +25,11 @@ from __future__ import annotations
|
|
|
25
25
|
|
|
26
26
|
import packaging.version
|
|
27
27
|
|
|
28
|
-
|
|
28
|
+
from airflow import __version__ as airflow_version
|
|
29
29
|
|
|
30
|
-
|
|
30
|
+
__all__ = ["__version__"]
|
|
31
31
|
|
|
32
|
-
|
|
33
|
-
from airflow import __version__ as airflow_version
|
|
34
|
-
except ImportError:
|
|
35
|
-
from airflow.version import version as airflow_version
|
|
32
|
+
__version__ = "1.14.0"
|
|
36
33
|
|
|
37
34
|
if packaging.version.parse(packaging.version.parse(airflow_version).base_version) < packaging.version.parse(
|
|
38
35
|
"2.7.0"
|
|
@@ -28,8 +28,9 @@ def get_provider_info():
|
|
|
28
28
|
"name": "Common SQL",
|
|
29
29
|
"description": "`Common SQL Provider <https://en.wikipedia.org/wiki/SQL>`__\n",
|
|
30
30
|
"state": "ready",
|
|
31
|
-
"source-date-epoch":
|
|
31
|
+
"source-date-epoch": 1716287213,
|
|
32
32
|
"versions": [
|
|
33
|
+
"1.14.0",
|
|
33
34
|
"1.13.0",
|
|
34
35
|
"1.12.0",
|
|
35
36
|
"1.11.1",
|
|
@@ -185,14 +185,15 @@ class DbApiHook(BaseHook):
|
|
|
185
185
|
def placeholder(self):
|
|
186
186
|
conn = self.get_connection(getattr(self, self.conn_name_attr))
|
|
187
187
|
placeholder = conn.extra_dejson.get("placeholder")
|
|
188
|
-
if placeholder
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
188
|
+
if placeholder:
|
|
189
|
+
if placeholder in SQL_PLACEHOLDERS:
|
|
190
|
+
return placeholder
|
|
191
|
+
self.log.warning(
|
|
192
|
+
"Placeholder defined in Connection '%s' is not listed in 'DEFAULT_SQL_PLACEHOLDERS' "
|
|
193
|
+
"and got ignored. Falling back to the default placeholder '%s'.",
|
|
194
|
+
self.conn_name_attr,
|
|
195
|
+
self._placeholder,
|
|
196
|
+
)
|
|
196
197
|
return self._placeholder
|
|
197
198
|
|
|
198
199
|
def get_conn(self):
|
|
@@ -578,13 +579,6 @@ class DbApiHook(BaseHook):
|
|
|
578
579
|
chunks defined by the commit_every parameter. This only works if all rows
|
|
579
580
|
have same number of column names, but leads to better performance.
|
|
580
581
|
"""
|
|
581
|
-
if executemany:
|
|
582
|
-
warnings.warn(
|
|
583
|
-
"executemany parameter is deprecated, override supports_executemany instead.",
|
|
584
|
-
AirflowProviderDeprecationWarning,
|
|
585
|
-
stacklevel=2,
|
|
586
|
-
)
|
|
587
|
-
|
|
588
582
|
nb_rows = 0
|
|
589
583
|
with self._create_autocommit_connection() as conn:
|
|
590
584
|
conn.commit()
|
|
@@ -16,16 +16,19 @@
|
|
|
16
16
|
# under the License.
|
|
17
17
|
from __future__ import annotations
|
|
18
18
|
|
|
19
|
-
from typing import Any, Sequence
|
|
19
|
+
from typing import TYPE_CHECKING, Any, Callable, Mapping, Sequence
|
|
20
20
|
|
|
21
21
|
from airflow.exceptions import AirflowException, AirflowSkipException
|
|
22
22
|
from airflow.hooks.base import BaseHook
|
|
23
23
|
from airflow.providers.common.sql.hooks.sql import DbApiHook
|
|
24
24
|
from airflow.sensors.base import BaseSensorOperator
|
|
25
25
|
|
|
26
|
+
if TYPE_CHECKING:
|
|
27
|
+
from airflow.utils.context import Context
|
|
28
|
+
|
|
26
29
|
|
|
27
30
|
class SqlSensor(BaseSensorOperator):
|
|
28
|
-
"""Run a
|
|
31
|
+
"""Run a SQL statement repeatedly until a criteria is met.
|
|
29
32
|
|
|
30
33
|
This will keep trying until success or failure criteria are met, or if the
|
|
31
34
|
first cell is not either ``0``, ``'0'``, ``''``, or ``None``. Optional
|
|
@@ -39,37 +42,34 @@ class SqlSensor(BaseSensorOperator):
|
|
|
39
42
|
in which case it will fail if no rows have been returned.
|
|
40
43
|
|
|
41
44
|
:param conn_id: The connection to run the sensor against
|
|
42
|
-
:param sql: The
|
|
45
|
+
:param sql: The SQL to run. To pass, it needs to return at least one cell
|
|
43
46
|
that contains a non-zero / empty string value.
|
|
44
47
|
:param parameters: The parameters to render the SQL query with (optional).
|
|
45
|
-
:param success: Success criteria for the sensor is a Callable that takes first_cell
|
|
48
|
+
:param success: Success criteria for the sensor is a Callable that takes the first_cell's value
|
|
46
49
|
as the only argument, and returns a boolean (optional).
|
|
47
|
-
:param failure: Failure criteria for the sensor is a Callable that takes first_cell
|
|
48
|
-
as the only argument and
|
|
50
|
+
:param failure: Failure criteria for the sensor is a Callable that takes the first_cell's value
|
|
51
|
+
as the only argument and returns a boolean (optional).
|
|
49
52
|
:param fail_on_empty: Explicitly fail on no rows returned.
|
|
50
53
|
:param hook_params: Extra config params to be passed to the underlying hook.
|
|
51
54
|
Should match the desired hook constructor params.
|
|
52
55
|
"""
|
|
53
56
|
|
|
54
|
-
template_fields: Sequence[str] = ("sql", "hook_params")
|
|
55
|
-
template_ext: Sequence[str] = (
|
|
56
|
-
".hql",
|
|
57
|
-
".sql",
|
|
58
|
-
)
|
|
57
|
+
template_fields: Sequence[str] = ("sql", "hook_params", "parameters")
|
|
58
|
+
template_ext: Sequence[str] = (".hql", ".sql")
|
|
59
59
|
ui_color = "#7c7287"
|
|
60
60
|
|
|
61
61
|
def __init__(
|
|
62
62
|
self,
|
|
63
63
|
*,
|
|
64
|
-
conn_id,
|
|
65
|
-
sql,
|
|
66
|
-
parameters=None,
|
|
67
|
-
success=None,
|
|
68
|
-
failure=None,
|
|
69
|
-
fail_on_empty=False,
|
|
70
|
-
hook_params=None,
|
|
64
|
+
conn_id: str,
|
|
65
|
+
sql: str,
|
|
66
|
+
parameters: Mapping[str, Any] | None = None,
|
|
67
|
+
success: Callable[[Any], bool] | None = None,
|
|
68
|
+
failure: Callable[[Any], bool] | None = None,
|
|
69
|
+
fail_on_empty: bool = False,
|
|
70
|
+
hook_params: Mapping[str, Any] | None = None,
|
|
71
71
|
**kwargs,
|
|
72
|
-
):
|
|
72
|
+
) -> None:
|
|
73
73
|
self.conn_id = conn_id
|
|
74
74
|
self.sql = sql
|
|
75
75
|
self.parameters = parameters
|
|
@@ -79,7 +79,7 @@ class SqlSensor(BaseSensorOperator):
|
|
|
79
79
|
self.hook_params = hook_params
|
|
80
80
|
super().__init__(**kwargs)
|
|
81
81
|
|
|
82
|
-
def _get_hook(self):
|
|
82
|
+
def _get_hook(self) -> DbApiHook:
|
|
83
83
|
conn = BaseHook.get_connection(self.conn_id)
|
|
84
84
|
hook = conn.get_hook(hook_params=self.hook_params)
|
|
85
85
|
if not isinstance(hook, DbApiHook):
|
|
@@ -89,7 +89,7 @@ class SqlSensor(BaseSensorOperator):
|
|
|
89
89
|
)
|
|
90
90
|
return hook
|
|
91
91
|
|
|
92
|
-
def poke(self, context:
|
|
92
|
+
def poke(self, context: Context) -> bool:
|
|
93
93
|
hook = self._get_hook()
|
|
94
94
|
|
|
95
95
|
self.log.info("Poking: %s (with parameters %s)", self.sql, self.parameters)
|
|
@@ -39,7 +39,8 @@ from airflow.exceptions import (
|
|
|
39
39
|
from airflow.hooks.base import BaseHook as BaseHook
|
|
40
40
|
from airflow.providers.common.sql.hooks.sql import DbApiHook as DbApiHook
|
|
41
41
|
from airflow.sensors.base import BaseSensorOperator as BaseSensorOperator
|
|
42
|
-
from
|
|
42
|
+
from airflow.utils.context import Context as Context
|
|
43
|
+
from typing import Any, Callable, Mapping, Sequence
|
|
43
44
|
|
|
44
45
|
class SqlSensor(BaseSensorOperator):
|
|
45
46
|
template_fields: Sequence[str]
|
|
@@ -55,13 +56,13 @@ class SqlSensor(BaseSensorOperator):
|
|
|
55
56
|
def __init__(
|
|
56
57
|
self,
|
|
57
58
|
*,
|
|
58
|
-
conn_id,
|
|
59
|
-
sql,
|
|
60
|
-
parameters:
|
|
61
|
-
success:
|
|
62
|
-
failure:
|
|
59
|
+
conn_id: str,
|
|
60
|
+
sql: str,
|
|
61
|
+
parameters: Mapping[str, Any] | None = None,
|
|
62
|
+
success: Callable[[Any], bool] | None = None,
|
|
63
|
+
failure: Callable[[Any], bool] | None = None,
|
|
63
64
|
fail_on_empty: bool = False,
|
|
64
|
-
hook_params:
|
|
65
|
+
hook_params: Mapping[str, Any] | None = None,
|
|
65
66
|
**kwargs,
|
|
66
67
|
) -> None: ...
|
|
67
|
-
def poke(self, context:
|
|
68
|
+
def poke(self, context: Context) -> bool: ...
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: apache-airflow-providers-common-sql
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.14.0
|
|
4
4
|
Summary: Provider package apache-airflow-providers-common-sql for Apache Airflow
|
|
5
5
|
Keywords: airflow-provider,common.sql,airflow,integration
|
|
6
6
|
Author-email: Apache Software Foundation <dev@airflow.apache.org>
|
|
@@ -27,8 +27,8 @@ Requires-Dist: sqlparse>=0.4.2
|
|
|
27
27
|
Requires-Dist: apache-airflow-providers-openlineage ; extra == "openlineage"
|
|
28
28
|
Requires-Dist: pandas>=1.2.5,<2.2 ; extra == "pandas"
|
|
29
29
|
Project-URL: Bug Tracker, https://github.com/apache/airflow/issues
|
|
30
|
-
Project-URL: Changelog, https://airflow.apache.org/docs/apache-airflow-providers-common-sql/1.
|
|
31
|
-
Project-URL: Documentation, https://airflow.apache.org/docs/apache-airflow-providers-common-sql/1.
|
|
30
|
+
Project-URL: Changelog, https://airflow.apache.org/docs/apache-airflow-providers-common-sql/1.14.0/changelog.html
|
|
31
|
+
Project-URL: Documentation, https://airflow.apache.org/docs/apache-airflow-providers-common-sql/1.14.0
|
|
32
32
|
Project-URL: Slack Chat, https://s.apache.org/airflow-slack
|
|
33
33
|
Project-URL: Source Code, https://github.com/apache/airflow
|
|
34
34
|
Project-URL: Twitter, https://twitter.com/ApacheAirflow
|
|
@@ -80,7 +80,7 @@ Provides-Extra: pandas
|
|
|
80
80
|
|
|
81
81
|
Package ``apache-airflow-providers-common-sql``
|
|
82
82
|
|
|
83
|
-
Release: ``1.
|
|
83
|
+
Release: ``1.14.0``
|
|
84
84
|
|
|
85
85
|
|
|
86
86
|
`Common SQL Provider <https://en.wikipedia.org/wiki/SQL>`__
|
|
@@ -93,7 +93,7 @@ This is a provider package for ``common.sql`` provider. All classes for this pro
|
|
|
93
93
|
are in ``airflow.providers.common.sql`` python package.
|
|
94
94
|
|
|
95
95
|
You can find package information and changelog for the provider
|
|
96
|
-
in the `documentation <https://airflow.apache.org/docs/apache-airflow-providers-common-sql/1.
|
|
96
|
+
in the `documentation <https://airflow.apache.org/docs/apache-airflow-providers-common-sql/1.14.0/>`_.
|
|
97
97
|
|
|
98
98
|
Installation
|
|
99
99
|
------------
|
|
@@ -135,4 +135,4 @@ Dependent package
|
|
|
135
135
|
============================================================================================================== ===============
|
|
136
136
|
|
|
137
137
|
The changelog for the provider package can be found in the
|
|
138
|
-
`changelog <https://airflow.apache.org/docs/apache-airflow-providers-common-sql/1.
|
|
138
|
+
`changelog <https://airflow.apache.org/docs/apache-airflow-providers-common-sql/1.14.0/changelog.html>`_.
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
airflow/providers/common/sql/LICENSE,sha256=ywUBpKZc7Jb96rVt5I3IDbg7dIJAbUSHkuoDcF3jbH4,13569
|
|
2
2
|
airflow/providers/common/sql/README_API.md,sha256=CxhaS8EedZ4dcbLUPC4-GLCMaY3OH96oHxXttUGU06E,5932
|
|
3
|
-
airflow/providers/common/sql/__init__.py,sha256=
|
|
4
|
-
airflow/providers/common/sql/get_provider_info.py,sha256=
|
|
3
|
+
airflow/providers/common/sql/__init__.py,sha256=k0Ryh4awxoZH0cPucAClfGxISsmhjTBWgUEN2SFSy-k,1498
|
|
4
|
+
airflow/providers/common/sql/get_provider_info.py,sha256=xQaoDaRU_bu3uDKwh3OXT_lyXVjuHmnOlvDdDlkCXP8,3018
|
|
5
5
|
airflow/providers/common/sql/doc/adr/0001-record-architecture-decisions.md,sha256=TfANqrzoFto9PMOMza3MitIkXHGLx2kY_BhhF-N0_ow,1675
|
|
6
6
|
airflow/providers/common/sql/doc/adr/0002-return-common-data-structure-from-dbapihook-derived-hooks.md,sha256=ze5w9IVS-HkUwdZvPW8_JaJaVwel7-N6XdEVN4pTuCE,8457
|
|
7
7
|
airflow/providers/common/sql/hooks/__init__.py,sha256=9hdXHABrVpkbpjZgUft39kOFL2xSGeG4GEua0Hmelus,785
|
|
8
|
-
airflow/providers/common/sql/hooks/sql.py,sha256=
|
|
8
|
+
airflow/providers/common/sql/hooks/sql.py,sha256=x-jW6oSmCWU5RS3Ev9Hnau7M884KEUdaoXIKAlXHWKQ,29603
|
|
9
9
|
airflow/providers/common/sql/hooks/sql.pyi,sha256=iwsV-yalhYz5aBdPqaNl1x0YYYqjP75N18moKXbVYQU,5570
|
|
10
10
|
airflow/providers/common/sql/operators/__init__.py,sha256=9hdXHABrVpkbpjZgUft39kOFL2xSGeG4GEua0Hmelus,785
|
|
11
11
|
airflow/providers/common/sql/operators/sql.py,sha256=QuM-Dqsg1ytyYl26_-pN-cKuIQEAiwvmDpbcAemLFnI,48231
|
|
12
12
|
airflow/providers/common/sql/operators/sql.pyi,sha256=f66uuQmDvj6rsX36tGTbEpm6zK3R4Opmy5i6OmdSI7w,8554
|
|
13
13
|
airflow/providers/common/sql/sensors/__init__.py,sha256=9hdXHABrVpkbpjZgUft39kOFL2xSGeG4GEua0Hmelus,785
|
|
14
|
-
airflow/providers/common/sql/sensors/sql.py,sha256=
|
|
15
|
-
airflow/providers/common/sql/sensors/sql.pyi,sha256=
|
|
16
|
-
apache_airflow_providers_common_sql-1.
|
|
17
|
-
apache_airflow_providers_common_sql-1.
|
|
18
|
-
apache_airflow_providers_common_sql-1.
|
|
19
|
-
apache_airflow_providers_common_sql-1.
|
|
14
|
+
airflow/providers/common/sql/sensors/sql.py,sha256=yy8prgci9YPM8rgK8RCjtYxvInb-DxiZaFCucMnTJUg,5969
|
|
15
|
+
airflow/providers/common/sql/sensors/sql.pyi,sha256=hDt9OeV5SHpz4s8yHhohrEUzNuKBgT4IHOU5b9rQnKo,2706
|
|
16
|
+
apache_airflow_providers_common_sql-1.14.0.dist-info/entry_points.txt,sha256=h8UXRp2crPuGmYVYRM5oe168qIh7g-4t2QQbVMizKjI,106
|
|
17
|
+
apache_airflow_providers_common_sql-1.14.0.dist-info/WHEEL,sha256=EZbGkh7Ie4PoZfRQ8I0ZuP9VklN_TvcZ6DSE5Uar4z4,81
|
|
18
|
+
apache_airflow_providers_common_sql-1.14.0.dist-info/METADATA,sha256=5wbiaVM87g6LRfJtbGedL-xGulRELFaEGWF1G8hN3Tc,6108
|
|
19
|
+
apache_airflow_providers_common_sql-1.14.0.dist-info/RECORD,,
|
|
File without changes
|