apache-airflow-providers-common-sql 1.14.1rc1__tar.gz → 1.14.2rc1__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.

Files changed (18) hide show
  1. {apache_airflow_providers_common_sql-1.14.1rc1 → apache_airflow_providers_common_sql-1.14.2rc1}/PKG-INFO +6 -6
  2. {apache_airflow_providers_common_sql-1.14.1rc1 → apache_airflow_providers_common_sql-1.14.2rc1}/README.rst +3 -3
  3. {apache_airflow_providers_common_sql-1.14.1rc1 → apache_airflow_providers_common_sql-1.14.2rc1}/airflow/providers/common/sql/__init__.py +1 -1
  4. {apache_airflow_providers_common_sql-1.14.1rc1 → apache_airflow_providers_common_sql-1.14.2rc1}/airflow/providers/common/sql/get_provider_info.py +2 -1
  5. {apache_airflow_providers_common_sql-1.14.1rc1 → apache_airflow_providers_common_sql-1.14.2rc1}/airflow/providers/common/sql/hooks/sql.py +21 -11
  6. {apache_airflow_providers_common_sql-1.14.1rc1 → apache_airflow_providers_common_sql-1.14.2rc1}/airflow/providers/common/sql/hooks/sql.pyi +4 -1
  7. {apache_airflow_providers_common_sql-1.14.1rc1 → apache_airflow_providers_common_sql-1.14.2rc1}/airflow/providers/common/sql/operators/sql.py +6 -2
  8. {apache_airflow_providers_common_sql-1.14.1rc1 → apache_airflow_providers_common_sql-1.14.2rc1}/airflow/providers/common/sql/sensors/sql.py +2 -1
  9. {apache_airflow_providers_common_sql-1.14.1rc1 → apache_airflow_providers_common_sql-1.14.2rc1}/pyproject.toml +3 -3
  10. {apache_airflow_providers_common_sql-1.14.1rc1 → apache_airflow_providers_common_sql-1.14.2rc1}/airflow/providers/common/sql/LICENSE +0 -0
  11. {apache_airflow_providers_common_sql-1.14.1rc1 → apache_airflow_providers_common_sql-1.14.2rc1}/airflow/providers/common/sql/README_API.md +0 -0
  12. {apache_airflow_providers_common_sql-1.14.1rc1 → apache_airflow_providers_common_sql-1.14.2rc1}/airflow/providers/common/sql/doc/adr/0001-record-architecture-decisions.md +0 -0
  13. {apache_airflow_providers_common_sql-1.14.1rc1 → apache_airflow_providers_common_sql-1.14.2rc1}/airflow/providers/common/sql/doc/adr/0002-return-common-data-structure-from-dbapihook-derived-hooks.md +0 -0
  14. {apache_airflow_providers_common_sql-1.14.1rc1 → apache_airflow_providers_common_sql-1.14.2rc1}/airflow/providers/common/sql/hooks/__init__.py +0 -0
  15. {apache_airflow_providers_common_sql-1.14.1rc1 → apache_airflow_providers_common_sql-1.14.2rc1}/airflow/providers/common/sql/operators/__init__.py +0 -0
  16. {apache_airflow_providers_common_sql-1.14.1rc1 → apache_airflow_providers_common_sql-1.14.2rc1}/airflow/providers/common/sql/operators/sql.pyi +0 -0
  17. {apache_airflow_providers_common_sql-1.14.1rc1 → apache_airflow_providers_common_sql-1.14.2rc1}/airflow/providers/common/sql/sensors/__init__.py +0 -0
  18. {apache_airflow_providers_common_sql-1.14.1rc1 → apache_airflow_providers_common_sql-1.14.2rc1}/airflow/providers/common/sql/sensors/sql.pyi +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: apache-airflow-providers-common-sql
3
- Version: 1.14.1rc1
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.1/changelog.html
32
- Project-URL: Documentation, https://airflow.apache.org/docs/apache-airflow-providers-common-sql/1.14.1
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.1.rc1``
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.1/>`_.
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.1/changelog.html>`_.
139
+ `changelog <https://airflow.apache.org/docs/apache-airflow-providers-common-sql/1.14.2/changelog.html>`_.
@@ -42,7 +42,7 @@
42
42
 
43
43
  Package ``apache-airflow-providers-common-sql``
44
44
 
45
- Release: ``1.14.1.rc1``
45
+ Release: ``1.14.2.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.14.1/>`_.
58
+ in the `documentation <https://airflow.apache.org/docs/apache-airflow-providers-common-sql/1.14.2/>`_.
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.14.1/changelog.html>`_.
100
+ `changelog <https://airflow.apache.org/docs/apache-airflow-providers-common-sql/1.14.2/changelog.html>`_.
@@ -29,7 +29,7 @@ from airflow import __version__ as airflow_version
29
29
 
30
30
  __all__ = ["__version__"]
31
31
 
32
- __version__ = "1.14.1"
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": 1718604106,
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
- @property
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(getattr(self, self.conn_name_attr))
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
- self.conn_name_attr,
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(getattr(self, cast(str, self.conn_name_attr)))
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(getattr(self, self.conn_name_attr))
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
- """Run a command or a list of commands.
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
- """Ensure the data returned from an SQL command is a standard tuple or list[tuple].
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
- getattr(self, self.conn_name_attr),
511
+ self.get_conn_id(),
504
512
  )
505
513
  conn.autocommit = autocommit
506
514
 
507
515
  def get_autocommit(self, conn) -> bool:
508
- """Get autocommit setting for the provided connection.
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
- """Insert a collection of tuples into a table.
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
- @property
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
- """Try to parse a string into boolean.
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.schema = self.database
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
- """Run a SQL statement repeatedly until a criteria is met.
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
@@ -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.14.1.rc1"
31
+ version = "1.14.2.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.14.1"
66
- "Changelog" = "https://airflow.apache.org/docs/apache-airflow-providers-common-sql/1.14.1/changelog.html"
65
+ "Documentation" = "https://airflow.apache.org/docs/apache-airflow-providers-common-sql/1.14.2"
66
+ "Changelog" = "https://airflow.apache.org/docs/apache-airflow-providers-common-sql/1.14.2/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"