apache-airflow-providers-common-sql 1.14.1rc1__py3-none-any.whl → 1.14.2rc1__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.
Potentially problematic release.
This version of apache-airflow-providers-common-sql might be problematic. Click here for more details.
- airflow/providers/common/sql/__init__.py +1 -1
- airflow/providers/common/sql/get_provider_info.py +2 -1
- airflow/providers/common/sql/hooks/sql.py +21 -11
- airflow/providers/common/sql/hooks/sql.pyi +4 -1
- airflow/providers/common/sql/operators/sql.py +6 -2
- airflow/providers/common/sql/sensors/sql.py +2 -1
- {apache_airflow_providers_common_sql-1.14.1rc1.dist-info → apache_airflow_providers_common_sql-1.14.2rc1.dist-info}/METADATA +6 -6
- {apache_airflow_providers_common_sql-1.14.1rc1.dist-info → apache_airflow_providers_common_sql-1.14.2rc1.dist-info}/RECORD +10 -10
- {apache_airflow_providers_common_sql-1.14.1rc1.dist-info → apache_airflow_providers_common_sql-1.14.2rc1.dist-info}/WHEEL +0 -0
- {apache_airflow_providers_common_sql-1.14.1rc1.dist-info → apache_airflow_providers_common_sql-1.14.2rc1.dist-info}/entry_points.txt +0 -0
|
@@ -29,7 +29,7 @@ from airflow import __version__ as airflow_version
|
|
|
29
29
|
|
|
30
30
|
__all__ = ["__version__"]
|
|
31
31
|
|
|
32
|
-
__version__ = "1.14.
|
|
32
|
+
__version__ = "1.14.2"
|
|
33
33
|
|
|
34
34
|
if packaging.version.parse(packaging.version.parse(airflow_version).base_version) < packaging.version.parse(
|
|
35
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": 1720422590,
|
|
32
32
|
"versions": [
|
|
33
|
+
"1.14.2",
|
|
33
34
|
"1.14.1",
|
|
34
35
|
"1.14.0",
|
|
35
36
|
"1.13.0",
|
|
@@ -20,6 +20,7 @@ import contextlib
|
|
|
20
20
|
import warnings
|
|
21
21
|
from contextlib import closing, contextmanager
|
|
22
22
|
from datetime import datetime
|
|
23
|
+
from functools import cached_property
|
|
23
24
|
from typing import (
|
|
24
25
|
TYPE_CHECKING,
|
|
25
26
|
Any,
|
|
@@ -54,6 +55,7 @@ if TYPE_CHECKING:
|
|
|
54
55
|
from airflow.providers.openlineage.extractors import OperatorLineage
|
|
55
56
|
from airflow.providers.openlineage.sqlparser import DatabaseInfo
|
|
56
57
|
|
|
58
|
+
|
|
57
59
|
T = TypeVar("T")
|
|
58
60
|
SQL_PLACEHOLDERS = frozenset({"%s", "?"})
|
|
59
61
|
|
|
@@ -181,24 +183,28 @@ class DbApiHook(BaseHook):
|
|
|
181
183
|
"replace_statement_format", "REPLACE INTO {} {} VALUES ({})"
|
|
182
184
|
)
|
|
183
185
|
|
|
184
|
-
|
|
186
|
+
def get_conn_id(self) -> str:
|
|
187
|
+
return getattr(self, self.conn_name_attr)
|
|
188
|
+
|
|
189
|
+
@cached_property
|
|
185
190
|
def placeholder(self):
|
|
186
|
-
conn = self.get_connection(
|
|
191
|
+
conn = self.get_connection(self.get_conn_id())
|
|
187
192
|
placeholder = conn.extra_dejson.get("placeholder")
|
|
188
193
|
if placeholder:
|
|
189
194
|
if placeholder in SQL_PLACEHOLDERS:
|
|
190
195
|
return placeholder
|
|
191
196
|
self.log.warning(
|
|
192
|
-
"Placeholder defined in Connection '%s' is not listed in 'DEFAULT_SQL_PLACEHOLDERS' "
|
|
197
|
+
"Placeholder '%s' defined in Connection '%s' is not listed in 'DEFAULT_SQL_PLACEHOLDERS' "
|
|
193
198
|
"and got ignored. Falling back to the default placeholder '%s'.",
|
|
194
|
-
|
|
199
|
+
placeholder,
|
|
200
|
+
self.get_conn_id(),
|
|
195
201
|
self._placeholder,
|
|
196
202
|
)
|
|
197
203
|
return self._placeholder
|
|
198
204
|
|
|
199
205
|
def get_conn(self):
|
|
200
206
|
"""Return a connection object."""
|
|
201
|
-
db = self.get_connection(
|
|
207
|
+
db = self.get_connection(self.get_conn_id())
|
|
202
208
|
return self.connector.connect(host=db.host, port=db.port, username=db.login, schema=db.schema)
|
|
203
209
|
|
|
204
210
|
def get_uri(self) -> str:
|
|
@@ -207,7 +213,7 @@ class DbApiHook(BaseHook):
|
|
|
207
213
|
|
|
208
214
|
:return: the extracted uri.
|
|
209
215
|
"""
|
|
210
|
-
conn = self.get_connection(
|
|
216
|
+
conn = self.get_connection(self.get_conn_id())
|
|
211
217
|
conn.schema = self.__schema or conn.schema
|
|
212
218
|
return conn.get_uri()
|
|
213
219
|
|
|
@@ -363,7 +369,8 @@ class DbApiHook(BaseHook):
|
|
|
363
369
|
split_statements: bool = False,
|
|
364
370
|
return_last: bool = True,
|
|
365
371
|
) -> tuple | list[tuple] | list[list[tuple] | tuple] | None:
|
|
366
|
-
"""
|
|
372
|
+
"""
|
|
373
|
+
Run a command or a list of commands.
|
|
367
374
|
|
|
368
375
|
Pass a list of SQL statements to the sql parameter to get them to
|
|
369
376
|
execute sequentially.
|
|
@@ -456,7 +463,8 @@ class DbApiHook(BaseHook):
|
|
|
456
463
|
return results
|
|
457
464
|
|
|
458
465
|
def _make_common_data_structure(self, result: T | Sequence[T]) -> tuple | list[tuple]:
|
|
459
|
-
"""
|
|
466
|
+
"""
|
|
467
|
+
Ensure the data returned from an SQL command is a standard tuple or list[tuple].
|
|
460
468
|
|
|
461
469
|
This method is intended to be overridden by subclasses of the `DbApiHook`. Its purpose is to
|
|
462
470
|
transform the result of an SQL command (typically returned by cursor methods) into a common
|
|
@@ -500,12 +508,13 @@ class DbApiHook(BaseHook):
|
|
|
500
508
|
if not self.supports_autocommit and autocommit:
|
|
501
509
|
self.log.warning(
|
|
502
510
|
"%s connection doesn't support autocommit but autocommit activated.",
|
|
503
|
-
|
|
511
|
+
self.get_conn_id(),
|
|
504
512
|
)
|
|
505
513
|
conn.autocommit = autocommit
|
|
506
514
|
|
|
507
515
|
def get_autocommit(self, conn) -> bool:
|
|
508
|
-
"""
|
|
516
|
+
"""
|
|
517
|
+
Get autocommit setting for the provided connection.
|
|
509
518
|
|
|
510
519
|
:param conn: Connection to get autocommit setting from.
|
|
511
520
|
:return: connection autocommit setting. True if ``autocommit`` is set
|
|
@@ -564,7 +573,8 @@ class DbApiHook(BaseHook):
|
|
|
564
573
|
executemany=False,
|
|
565
574
|
**kwargs,
|
|
566
575
|
):
|
|
567
|
-
"""
|
|
576
|
+
"""
|
|
577
|
+
Insert a collection of tuples into a table.
|
|
568
578
|
|
|
569
579
|
Rows are inserted in chunks, each chunk (of size ``commit_every``) is
|
|
570
580
|
done in a new transaction.
|
|
@@ -40,6 +40,7 @@ from airflow.exceptions import (
|
|
|
40
40
|
from airflow.hooks.base import BaseHook as BaseHook
|
|
41
41
|
from airflow.providers.openlineage.extractors import OperatorLineage as OperatorLineage
|
|
42
42
|
from airflow.providers.openlineage.sqlparser import DatabaseInfo as DatabaseInfo
|
|
43
|
+
from functools import cached_property as cached_property
|
|
43
44
|
from pandas import DataFrame as DataFrame
|
|
44
45
|
from sqlalchemy.engine import URL as URL
|
|
45
46
|
from typing import Any, Callable, Generator, Iterable, Mapping, Protocol, Sequence, TypeVar, overload
|
|
@@ -63,7 +64,9 @@ class DbApiHook(BaseHook):
|
|
|
63
64
|
log_sql: Incomplete
|
|
64
65
|
descriptions: Incomplete
|
|
65
66
|
def __init__(self, *args, schema: str | None = None, log_sql: bool = True, **kwargs) -> None: ...
|
|
66
|
-
|
|
67
|
+
|
|
68
|
+
def get_conn_id(self) -> str: ...
|
|
69
|
+
@cached_property
|
|
67
70
|
def placeholder(self): ...
|
|
68
71
|
def get_conn(self): ...
|
|
69
72
|
def get_uri(self) -> str: ...
|
|
@@ -41,7 +41,8 @@ def _convert_to_float_if_possible(s: str) -> float | str:
|
|
|
41
41
|
|
|
42
42
|
|
|
43
43
|
def _parse_boolean(val: str) -> str | bool:
|
|
44
|
-
"""
|
|
44
|
+
"""
|
|
45
|
+
Try to parse a string into boolean.
|
|
45
46
|
|
|
46
47
|
Raises ValueError if the input is not a valid true- or false-like string value.
|
|
47
48
|
"""
|
|
@@ -177,7 +178,10 @@ class BaseSQLOperator(BaseOperator):
|
|
|
177
178
|
)
|
|
178
179
|
|
|
179
180
|
if self.database:
|
|
180
|
-
hook.
|
|
181
|
+
if hook.conn_type == "postgres":
|
|
182
|
+
hook.database = self.database
|
|
183
|
+
else:
|
|
184
|
+
hook.schema = self.database
|
|
181
185
|
|
|
182
186
|
return hook
|
|
183
187
|
|
|
@@ -28,7 +28,8 @@ if TYPE_CHECKING:
|
|
|
28
28
|
|
|
29
29
|
|
|
30
30
|
class SqlSensor(BaseSensorOperator):
|
|
31
|
-
"""
|
|
31
|
+
"""
|
|
32
|
+
Run a SQL statement repeatedly until a criteria is met.
|
|
32
33
|
|
|
33
34
|
This will keep trying until success or failure criteria are met, or if the
|
|
34
35
|
first cell is not either ``0``, ``'0'``, ``''``, or ``None``. Optional
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: apache-airflow-providers-common-sql
|
|
3
|
-
Version: 1.14.
|
|
3
|
+
Version: 1.14.2rc1
|
|
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.14.
|
|
32
|
-
Project-URL: Documentation, https://airflow.apache.org/docs/apache-airflow-providers-common-sql/1.14.
|
|
31
|
+
Project-URL: Changelog, https://airflow.apache.org/docs/apache-airflow-providers-common-sql/1.14.2/changelog.html
|
|
32
|
+
Project-URL: Documentation, https://airflow.apache.org/docs/apache-airflow-providers-common-sql/1.14.2
|
|
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.14.
|
|
84
|
+
Release: ``1.14.2.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.14.
|
|
97
|
+
in the `documentation <https://airflow.apache.org/docs/apache-airflow-providers-common-sql/1.14.2/>`_.
|
|
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.14.
|
|
139
|
+
`changelog <https://airflow.apache.org/docs/apache-airflow-providers-common-sql/1.14.2/changelog.html>`_.
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
airflow/providers/common/sql/LICENSE,sha256=FFb4jd2AXnOOf7XLP04pQW6jbdhG49TxlGY6fFpCV1Y,13609
|
|
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=_e9jiJfneIarxjGWFuYzbtLFQUoaqUUEfQ0tRZNr3Mc,1498
|
|
4
|
+
airflow/providers/common/sql/get_provider_info.py,sha256=25Djfn7WkF5fNCpnIfjUmqxanaoxOQCGpS6Dw80Z4Uc,3255
|
|
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=
|
|
9
|
-
airflow/providers/common/sql/hooks/sql.pyi,sha256=
|
|
8
|
+
airflow/providers/common/sql/hooks/sql.py,sha256=Ax3Q1mUsTgIVUWglb6jrXGVONmwL1WJkSLsXRfa6Tqg,29728
|
|
9
|
+
airflow/providers/common/sql/hooks/sql.pyi,sha256=5cERPx3bJVspqP_jDuhg0p4DUhge5W5q_HcJEStfztA,5673
|
|
10
10
|
airflow/providers/common/sql/operators/__init__.py,sha256=9hdXHABrVpkbpjZgUft39kOFL2xSGeG4GEua0Hmelus,785
|
|
11
|
-
airflow/providers/common/sql/operators/sql.py,sha256=
|
|
11
|
+
airflow/providers/common/sql/operators/sql.py,sha256=hX42WOWOLcVIORP8TIUTUVoA8g_nF4sucX4Cl2BMXVk,48553
|
|
12
12
|
airflow/providers/common/sql/operators/sql.pyi,sha256=WrzYlWtRT8SGswxPsXMv8oqobrooOlEWeGOjtMnNEBI,8589
|
|
13
13
|
airflow/providers/common/sql/sensors/__init__.py,sha256=9hdXHABrVpkbpjZgUft39kOFL2xSGeG4GEua0Hmelus,785
|
|
14
|
-
airflow/providers/common/sql/sensors/sql.py,sha256=
|
|
14
|
+
airflow/providers/common/sql/sensors/sql.py,sha256=Yz_O4w5zA4HUZSH1f4aR2ry5P1fcTdyRnqIWZ69ggEs,5974
|
|
15
15
|
airflow/providers/common/sql/sensors/sql.pyi,sha256=hDt9OeV5SHpz4s8yHhohrEUzNuKBgT4IHOU5b9rQnKo,2706
|
|
16
|
-
apache_airflow_providers_common_sql-1.14.
|
|
17
|
-
apache_airflow_providers_common_sql-1.14.
|
|
18
|
-
apache_airflow_providers_common_sql-1.14.
|
|
19
|
-
apache_airflow_providers_common_sql-1.14.
|
|
16
|
+
apache_airflow_providers_common_sql-1.14.2rc1.dist-info/entry_points.txt,sha256=h8UXRp2crPuGmYVYRM5oe168qIh7g-4t2QQbVMizKjI,106
|
|
17
|
+
apache_airflow_providers_common_sql-1.14.2rc1.dist-info/WHEEL,sha256=EZbGkh7Ie4PoZfRQ8I0ZuP9VklN_TvcZ6DSE5Uar4z4,81
|
|
18
|
+
apache_airflow_providers_common_sql-1.14.2rc1.dist-info/METADATA,sha256=F55SR9cp9IDYheZD7Ea9noWxsB0qajZ2nxURa11HNaM,6227
|
|
19
|
+
apache_airflow_providers_common_sql-1.14.2rc1.dist-info/RECORD,,
|
|
File without changes
|