apache-airflow-providers-common-sql 1.16.0rc1__tar.gz → 1.17.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.
Potentially problematic release.
This version of apache-airflow-providers-common-sql might be problematic. Click here for more details.
- {apache_airflow_providers_common_sql-1.16.0rc1 → apache_airflow_providers_common_sql-1.17.0rc1}/PKG-INFO +6 -6
- {apache_airflow_providers_common_sql-1.16.0rc1 → apache_airflow_providers_common_sql-1.17.0rc1}/README.rst +3 -3
- {apache_airflow_providers_common_sql-1.16.0rc1 → apache_airflow_providers_common_sql-1.17.0rc1}/airflow/providers/common/sql/__init__.py +1 -1
- {apache_airflow_providers_common_sql-1.16.0rc1 → apache_airflow_providers_common_sql-1.17.0rc1}/airflow/providers/common/sql/get_provider_info.py +1 -0
- {apache_airflow_providers_common_sql-1.16.0rc1 → apache_airflow_providers_common_sql-1.17.0rc1}/airflow/providers/common/sql/hooks/sql.py +32 -3
- {apache_airflow_providers_common_sql-1.16.0rc1 → apache_airflow_providers_common_sql-1.17.0rc1}/airflow/providers/common/sql/hooks/sql.pyi +8 -0
- {apache_airflow_providers_common_sql-1.16.0rc1 → apache_airflow_providers_common_sql-1.17.0rc1}/airflow/providers/common/sql/sensors/sql.py +1 -13
- {apache_airflow_providers_common_sql-1.16.0rc1 → apache_airflow_providers_common_sql-1.17.0rc1}/airflow/providers/common/sql/sensors/sql.pyi +1 -4
- {apache_airflow_providers_common_sql-1.16.0rc1 → apache_airflow_providers_common_sql-1.17.0rc1}/pyproject.toml +3 -3
- {apache_airflow_providers_common_sql-1.16.0rc1 → apache_airflow_providers_common_sql-1.17.0rc1}/airflow/providers/common/sql/LICENSE +0 -0
- {apache_airflow_providers_common_sql-1.16.0rc1 → apache_airflow_providers_common_sql-1.17.0rc1}/airflow/providers/common/sql/README_API.md +0 -0
- {apache_airflow_providers_common_sql-1.16.0rc1 → apache_airflow_providers_common_sql-1.17.0rc1}/airflow/providers/common/sql/doc/adr/0001-record-architecture-decisions.md +0 -0
- {apache_airflow_providers_common_sql-1.16.0rc1 → apache_airflow_providers_common_sql-1.17.0rc1}/airflow/providers/common/sql/doc/adr/0002-return-common-data-structure-from-dbapihook-derived-hooks.md +0 -0
- {apache_airflow_providers_common_sql-1.16.0rc1 → apache_airflow_providers_common_sql-1.17.0rc1}/airflow/providers/common/sql/hooks/__init__.py +0 -0
- {apache_airflow_providers_common_sql-1.16.0rc1 → apache_airflow_providers_common_sql-1.17.0rc1}/airflow/providers/common/sql/operators/__init__.py +0 -0
- {apache_airflow_providers_common_sql-1.16.0rc1 → apache_airflow_providers_common_sql-1.17.0rc1}/airflow/providers/common/sql/operators/sql.py +0 -0
- {apache_airflow_providers_common_sql-1.16.0rc1 → apache_airflow_providers_common_sql-1.17.0rc1}/airflow/providers/common/sql/operators/sql.pyi +0 -0
- {apache_airflow_providers_common_sql-1.16.0rc1 → apache_airflow_providers_common_sql-1.17.0rc1}/airflow/providers/common/sql/sensors/__init__.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: apache-airflow-providers-common-sql
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.17.0rc1
|
|
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>
|
|
@@ -28,8 +28,8 @@ Requires-Dist: apache-airflow-providers-openlineage ; extra == "openlineage"
|
|
|
28
28
|
Requires-Dist: pandas>=2.1.2,<2.2 ; extra == "pandas" and (python_version>="3.9")
|
|
29
29
|
Requires-Dist: pandas>=1.5.3,<2.2 ; extra == "pandas" and (python_version<"3.9")
|
|
30
30
|
Project-URL: Bug Tracker, https://github.com/apache/airflow/issues
|
|
31
|
-
Project-URL: Changelog, https://airflow.apache.org/docs/apache-airflow-providers-common-sql/1.
|
|
32
|
-
Project-URL: Documentation, https://airflow.apache.org/docs/apache-airflow-providers-common-sql/1.
|
|
31
|
+
Project-URL: Changelog, https://airflow.apache.org/docs/apache-airflow-providers-common-sql/1.17.0/changelog.html
|
|
32
|
+
Project-URL: Documentation, https://airflow.apache.org/docs/apache-airflow-providers-common-sql/1.17.0
|
|
33
33
|
Project-URL: Slack Chat, https://s.apache.org/airflow-slack
|
|
34
34
|
Project-URL: Source Code, https://github.com/apache/airflow
|
|
35
35
|
Project-URL: Twitter, https://twitter.com/ApacheAirflow
|
|
@@ -81,7 +81,7 @@ Provides-Extra: pandas
|
|
|
81
81
|
|
|
82
82
|
Package ``apache-airflow-providers-common-sql``
|
|
83
83
|
|
|
84
|
-
Release: ``1.
|
|
84
|
+
Release: ``1.17.0.rc1``
|
|
85
85
|
|
|
86
86
|
|
|
87
87
|
`Common SQL Provider <https://en.wikipedia.org/wiki/SQL>`__
|
|
@@ -94,7 +94,7 @@ This is a provider package for ``common.sql`` provider. All classes for this pro
|
|
|
94
94
|
are in ``airflow.providers.common.sql`` python package.
|
|
95
95
|
|
|
96
96
|
You can find package information and changelog for the provider
|
|
97
|
-
in the `documentation <https://airflow.apache.org/docs/apache-airflow-providers-common-sql/1.
|
|
97
|
+
in the `documentation <https://airflow.apache.org/docs/apache-airflow-providers-common-sql/1.17.0/>`_.
|
|
98
98
|
|
|
99
99
|
Installation
|
|
100
100
|
------------
|
|
@@ -136,4 +136,4 @@ Dependent package
|
|
|
136
136
|
============================================================================================================== ===============
|
|
137
137
|
|
|
138
138
|
The changelog for the provider package can be found in the
|
|
139
|
-
`changelog <https://airflow.apache.org/docs/apache-airflow-providers-common-sql/1.
|
|
139
|
+
`changelog <https://airflow.apache.org/docs/apache-airflow-providers-common-sql/1.17.0/changelog.html>`_.
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
|
|
43
43
|
Package ``apache-airflow-providers-common-sql``
|
|
44
44
|
|
|
45
|
-
Release: ``1.
|
|
45
|
+
Release: ``1.17.0.rc1``
|
|
46
46
|
|
|
47
47
|
|
|
48
48
|
`Common SQL Provider <https://en.wikipedia.org/wiki/SQL>`__
|
|
@@ -55,7 +55,7 @@ This is a provider package for ``common.sql`` provider. All classes for this pro
|
|
|
55
55
|
are in ``airflow.providers.common.sql`` 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-common-sql/1.
|
|
58
|
+
in the `documentation <https://airflow.apache.org/docs/apache-airflow-providers-common-sql/1.17.0/>`_.
|
|
59
59
|
|
|
60
60
|
Installation
|
|
61
61
|
------------
|
|
@@ -97,4 +97,4 @@ Dependent package
|
|
|
97
97
|
============================================================================================================== ===============
|
|
98
98
|
|
|
99
99
|
The changelog for the provider package can be found in the
|
|
100
|
-
`changelog <https://airflow.apache.org/docs/apache-airflow-providers-common-sql/1.
|
|
100
|
+
`changelog <https://airflow.apache.org/docs/apache-airflow-providers-common-sql/1.17.0/changelog.html>`_.
|
|
@@ -29,7 +29,7 @@ from airflow import __version__ as airflow_version
|
|
|
29
29
|
|
|
30
30
|
__all__ = ["__version__"]
|
|
31
31
|
|
|
32
|
-
__version__ = "1.
|
|
32
|
+
__version__ = "1.17.0"
|
|
33
33
|
|
|
34
34
|
if packaging.version.parse(packaging.version.parse(airflow_version).base_version) < packaging.version.parse(
|
|
35
35
|
"2.8.0"
|
|
@@ -53,6 +53,7 @@ if TYPE_CHECKING:
|
|
|
53
53
|
from pandas import DataFrame
|
|
54
54
|
from sqlalchemy.engine import URL
|
|
55
55
|
|
|
56
|
+
from airflow.models import Connection
|
|
56
57
|
from airflow.providers.openlineage.extractors import OperatorLineage
|
|
57
58
|
from airflow.providers.openlineage.sqlparser import DatabaseInfo
|
|
58
59
|
|
|
@@ -183,14 +184,14 @@ class DbApiHook(BaseHook):
|
|
|
183
184
|
self._replace_statement_format: str = kwargs.get(
|
|
184
185
|
"replace_statement_format", "REPLACE INTO {} {} VALUES ({})"
|
|
185
186
|
)
|
|
187
|
+
self._connection: Connection | None = kwargs.pop("connection", None)
|
|
186
188
|
|
|
187
189
|
def get_conn_id(self) -> str:
|
|
188
190
|
return getattr(self, self.conn_name_attr)
|
|
189
191
|
|
|
190
192
|
@cached_property
|
|
191
193
|
def placeholder(self):
|
|
192
|
-
|
|
193
|
-
placeholder = conn.extra_dejson.get("placeholder")
|
|
194
|
+
placeholder = self.connection_extra.get("placeholder")
|
|
194
195
|
if placeholder:
|
|
195
196
|
if placeholder in SQL_PLACEHOLDERS:
|
|
196
197
|
return placeholder
|
|
@@ -203,9 +204,28 @@ class DbApiHook(BaseHook):
|
|
|
203
204
|
)
|
|
204
205
|
return self._placeholder
|
|
205
206
|
|
|
207
|
+
@property
|
|
208
|
+
def connection(self) -> Connection:
|
|
209
|
+
if self._connection is None:
|
|
210
|
+
self._connection = self.get_connection(self.get_conn_id())
|
|
211
|
+
return self._connection
|
|
212
|
+
|
|
213
|
+
@property
|
|
214
|
+
def connection_extra(self) -> dict:
|
|
215
|
+
return self.connection.extra_dejson
|
|
216
|
+
|
|
217
|
+
@cached_property
|
|
218
|
+
def connection_extra_lower(self) -> dict:
|
|
219
|
+
"""
|
|
220
|
+
``connection.extra_dejson`` but where keys are converted to lower case.
|
|
221
|
+
|
|
222
|
+
This is used internally for case-insensitive access of extra params.
|
|
223
|
+
"""
|
|
224
|
+
return {k.lower(): v for k, v in self.connection_extra.items()}
|
|
225
|
+
|
|
206
226
|
def get_conn(self):
|
|
207
227
|
"""Return a connection object."""
|
|
208
|
-
db = self.
|
|
228
|
+
db = self.connection
|
|
209
229
|
return self.connector.connect(host=db.host, port=db.port, username=db.login, schema=db.schema)
|
|
210
230
|
|
|
211
231
|
def get_uri(self) -> str:
|
|
@@ -467,6 +487,8 @@ class DbApiHook(BaseHook):
|
|
|
467
487
|
# If autocommit was set to False or db does not support autocommit, we do a manual commit.
|
|
468
488
|
if not self.get_autocommit(conn):
|
|
469
489
|
conn.commit()
|
|
490
|
+
# Logs all database messages or errors sent to the client
|
|
491
|
+
self.get_db_log_messages(conn)
|
|
470
492
|
|
|
471
493
|
if handler is None:
|
|
472
494
|
return None
|
|
@@ -741,3 +763,10 @@ class DbApiHook(BaseHook):
|
|
|
741
763
|
else:
|
|
742
764
|
authority = parsed.hostname
|
|
743
765
|
return authority
|
|
766
|
+
|
|
767
|
+
def get_db_log_messages(self, conn) -> None:
|
|
768
|
+
"""
|
|
769
|
+
Log all database messages sent to the client during the session.
|
|
770
|
+
|
|
771
|
+
:param conn: Connection object
|
|
772
|
+
"""
|
|
@@ -38,6 +38,7 @@ from airflow.exceptions import (
|
|
|
38
38
|
AirflowProviderDeprecationWarning as AirflowProviderDeprecationWarning,
|
|
39
39
|
)
|
|
40
40
|
from airflow.hooks.base import BaseHook as BaseHook
|
|
41
|
+
from airflow.models import Connection as Connection
|
|
41
42
|
from airflow.providers.openlineage.extractors import OperatorLineage as OperatorLineage
|
|
42
43
|
from airflow.providers.openlineage.sqlparser import DatabaseInfo as DatabaseInfo
|
|
43
44
|
from functools import cached_property as cached_property
|
|
@@ -67,6 +68,12 @@ class DbApiHook(BaseHook):
|
|
|
67
68
|
def get_conn_id(self) -> str: ...
|
|
68
69
|
@cached_property
|
|
69
70
|
def placeholder(self): ...
|
|
71
|
+
@property
|
|
72
|
+
def connection(self) -> Connection: ...
|
|
73
|
+
@property
|
|
74
|
+
def connection_extra(self) -> dict: ...
|
|
75
|
+
@cached_property
|
|
76
|
+
def connection_extra_lower(self) -> dict: ...
|
|
70
77
|
def get_conn(self): ...
|
|
71
78
|
def get_uri(self) -> str: ...
|
|
72
79
|
@property
|
|
@@ -136,3 +143,4 @@ class DbApiHook(BaseHook):
|
|
|
136
143
|
def get_openlineage_database_specific_lineage(self, task_instance) -> OperatorLineage | None: ...
|
|
137
144
|
@staticmethod
|
|
138
145
|
def get_openlineage_authority_part(connection, default_port: int | None = None) -> str: ...
|
|
146
|
+
def get_db_log_messages(self, conn) -> None: ...
|
|
@@ -18,7 +18,7 @@ from __future__ import annotations
|
|
|
18
18
|
|
|
19
19
|
from typing import TYPE_CHECKING, Any, Callable, Mapping, Sequence
|
|
20
20
|
|
|
21
|
-
from airflow.exceptions import AirflowException
|
|
21
|
+
from airflow.exceptions import AirflowException
|
|
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
|
|
@@ -97,10 +97,7 @@ class SqlSensor(BaseSensorOperator):
|
|
|
97
97
|
records = hook.get_records(self.sql, self.parameters)
|
|
98
98
|
if not records:
|
|
99
99
|
if self.fail_on_empty:
|
|
100
|
-
# TODO: remove this if block when min_airflow_version is set to higher than 2.7.1
|
|
101
100
|
message = "No rows returned, raising as per fail_on_empty flag"
|
|
102
|
-
if self.soft_fail:
|
|
103
|
-
raise AirflowSkipException(message)
|
|
104
101
|
raise AirflowException(message)
|
|
105
102
|
else:
|
|
106
103
|
return False
|
|
@@ -109,25 +106,16 @@ class SqlSensor(BaseSensorOperator):
|
|
|
109
106
|
if self.failure is not None:
|
|
110
107
|
if callable(self.failure):
|
|
111
108
|
if self.failure(first_cell):
|
|
112
|
-
# TODO: remove this if block when min_airflow_version is set to higher than 2.7.1
|
|
113
109
|
message = f"Failure criteria met. self.failure({first_cell}) returned True"
|
|
114
|
-
if self.soft_fail:
|
|
115
|
-
raise AirflowSkipException(message)
|
|
116
110
|
raise AirflowException(message)
|
|
117
111
|
else:
|
|
118
|
-
# TODO: remove this if block when min_airflow_version is set to higher than 2.7.1
|
|
119
112
|
message = f"self.failure is present, but not callable -> {self.failure}"
|
|
120
|
-
if self.soft_fail:
|
|
121
|
-
raise AirflowSkipException(message)
|
|
122
113
|
raise AirflowException(message)
|
|
123
114
|
|
|
124
115
|
if self.success is not None:
|
|
125
116
|
if callable(self.success):
|
|
126
117
|
return self.success(first_cell)
|
|
127
118
|
else:
|
|
128
|
-
# TODO: remove this if block when min_airflow_version is set to higher than 2.7.1
|
|
129
119
|
message = f"self.success is present, but not callable -> {self.success}"
|
|
130
|
-
if self.soft_fail:
|
|
131
|
-
raise AirflowSkipException(message)
|
|
132
120
|
raise AirflowException(message)
|
|
133
121
|
return bool(first_cell)
|
|
@@ -32,10 +32,7 @@ Definition of the public interface for airflow.providers.common.sql.sensors.sql
|
|
|
32
32
|
isort:skip_file
|
|
33
33
|
"""
|
|
34
34
|
from _typeshed import Incomplete
|
|
35
|
-
from airflow.exceptions import
|
|
36
|
-
AirflowException as AirflowException,
|
|
37
|
-
AirflowSkipException as AirflowSkipException,
|
|
38
|
-
)
|
|
35
|
+
from airflow.exceptions import AirflowException as AirflowException
|
|
39
36
|
from airflow.hooks.base import BaseHook as BaseHook
|
|
40
37
|
from airflow.providers.common.sql.hooks.sql import DbApiHook as DbApiHook
|
|
41
38
|
from airflow.sensors.base import BaseSensorOperator as BaseSensorOperator
|
|
@@ -28,7 +28,7 @@ build-backend = "flit_core.buildapi"
|
|
|
28
28
|
|
|
29
29
|
[project]
|
|
30
30
|
name = "apache-airflow-providers-common-sql"
|
|
31
|
-
version = "1.
|
|
31
|
+
version = "1.17.0.rc1"
|
|
32
32
|
description = "Provider package apache-airflow-providers-common-sql for Apache Airflow"
|
|
33
33
|
readme = "README.rst"
|
|
34
34
|
authors = [
|
|
@@ -62,8 +62,8 @@ dependencies = [
|
|
|
62
62
|
]
|
|
63
63
|
|
|
64
64
|
[project.urls]
|
|
65
|
-
"Documentation" = "https://airflow.apache.org/docs/apache-airflow-providers-common-sql/1.
|
|
66
|
-
"Changelog" = "https://airflow.apache.org/docs/apache-airflow-providers-common-sql/1.
|
|
65
|
+
"Documentation" = "https://airflow.apache.org/docs/apache-airflow-providers-common-sql/1.17.0"
|
|
66
|
+
"Changelog" = "https://airflow.apache.org/docs/apache-airflow-providers-common-sql/1.17.0/changelog.html"
|
|
67
67
|
"Bug Tracker" = "https://github.com/apache/airflow/issues"
|
|
68
68
|
"Source Code" = "https://github.com/apache/airflow"
|
|
69
69
|
"Slack Chat" = "https://s.apache.org/airflow-slack"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|