apache-airflow-providers-common-sql 1.13.0__tar.gz → 1.14.0__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.
Files changed (18) hide show
  1. {apache_airflow_providers_common_sql-1.13.0 → apache_airflow_providers_common_sql-1.14.0}/PKG-INFO +6 -6
  2. {apache_airflow_providers_common_sql-1.13.0 → apache_airflow_providers_common_sql-1.14.0}/README.rst +3 -3
  3. {apache_airflow_providers_common_sql-1.13.0 → apache_airflow_providers_common_sql-1.14.0}/airflow/providers/common/sql/__init__.py +3 -6
  4. {apache_airflow_providers_common_sql-1.13.0 → apache_airflow_providers_common_sql-1.14.0}/airflow/providers/common/sql/get_provider_info.py +2 -1
  5. {apache_airflow_providers_common_sql-1.13.0 → apache_airflow_providers_common_sql-1.14.0}/airflow/providers/common/sql/hooks/sql.py +9 -15
  6. {apache_airflow_providers_common_sql-1.13.0 → apache_airflow_providers_common_sql-1.14.0}/airflow/providers/common/sql/sensors/sql.py +21 -21
  7. {apache_airflow_providers_common_sql-1.13.0 → apache_airflow_providers_common_sql-1.14.0}/airflow/providers/common/sql/sensors/sql.pyi +9 -8
  8. {apache_airflow_providers_common_sql-1.13.0 → apache_airflow_providers_common_sql-1.14.0}/pyproject.toml +3 -3
  9. {apache_airflow_providers_common_sql-1.13.0 → apache_airflow_providers_common_sql-1.14.0}/airflow/providers/common/sql/LICENSE +0 -0
  10. {apache_airflow_providers_common_sql-1.13.0 → apache_airflow_providers_common_sql-1.14.0}/airflow/providers/common/sql/README_API.md +0 -0
  11. {apache_airflow_providers_common_sql-1.13.0 → apache_airflow_providers_common_sql-1.14.0}/airflow/providers/common/sql/doc/adr/0001-record-architecture-decisions.md +0 -0
  12. {apache_airflow_providers_common_sql-1.13.0 → apache_airflow_providers_common_sql-1.14.0}/airflow/providers/common/sql/doc/adr/0002-return-common-data-structure-from-dbapihook-derived-hooks.md +0 -0
  13. {apache_airflow_providers_common_sql-1.13.0 → apache_airflow_providers_common_sql-1.14.0}/airflow/providers/common/sql/hooks/__init__.py +0 -0
  14. {apache_airflow_providers_common_sql-1.13.0 → apache_airflow_providers_common_sql-1.14.0}/airflow/providers/common/sql/hooks/sql.pyi +0 -0
  15. {apache_airflow_providers_common_sql-1.13.0 → apache_airflow_providers_common_sql-1.14.0}/airflow/providers/common/sql/operators/__init__.py +0 -0
  16. {apache_airflow_providers_common_sql-1.13.0 → apache_airflow_providers_common_sql-1.14.0}/airflow/providers/common/sql/operators/sql.py +0 -0
  17. {apache_airflow_providers_common_sql-1.13.0 → apache_airflow_providers_common_sql-1.14.0}/airflow/providers/common/sql/operators/sql.pyi +0 -0
  18. {apache_airflow_providers_common_sql-1.13.0 → apache_airflow_providers_common_sql-1.14.0}/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.13.0
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.13.0/changelog.html
31
- Project-URL: Documentation, https://airflow.apache.org/docs/apache-airflow-providers-common-sql/1.13.0
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.13.0``
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.13.0/>`_.
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.13.0/changelog.html>`_.
138
+ `changelog <https://airflow.apache.org/docs/apache-airflow-providers-common-sql/1.14.0/changelog.html>`_.
@@ -42,7 +42,7 @@
42
42
 
43
43
  Package ``apache-airflow-providers-common-sql``
44
44
 
45
- Release: ``1.13.0``
45
+ Release: ``1.14.0``
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.13.0/>`_.
58
+ in the `documentation <https://airflow.apache.org/docs/apache-airflow-providers-common-sql/1.14.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.13.0/changelog.html>`_.
100
+ `changelog <https://airflow.apache.org/docs/apache-airflow-providers-common-sql/1.14.0/changelog.html>`_.
@@ -25,14 +25,11 @@ from __future__ import annotations
25
25
 
26
26
  import packaging.version
27
27
 
28
- __all__ = ["__version__"]
28
+ from airflow import __version__ as airflow_version
29
29
 
30
- __version__ = "1.13.0"
30
+ __all__ = ["__version__"]
31
31
 
32
- try:
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": 1714476113,
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 in SQL_PLACEHOLDERS:
189
- return placeholder
190
- self.log.warning(
191
- "Placeholder defined in Connection '%s' is not listed in 'DEFAULT_SQL_PLACEHOLDERS' "
192
- "and got ignored. Falling back to the default placeholder '%s'.",
193
- placeholder,
194
- self._placeholder,
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 sql statement repeatedly until a criteria is met.
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 sql to run. To pass, it needs to return at least one cell
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 return a boolean (optional).
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: Any):
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 typing import Any, Sequence
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: Incomplete | None = None,
61
- success: Incomplete | None = None,
62
- failure: Incomplete | None = None,
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: Incomplete | None = None,
65
+ hook_params: Mapping[str, Any] | None = None,
65
66
  **kwargs,
66
67
  ) -> None: ...
67
- def poke(self, context: Any): ...
68
+ def poke(self, context: Context) -> bool: ...
@@ -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.13.0"
31
+ version = "1.14.0"
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.13.0"
66
- "Changelog" = "https://airflow.apache.org/docs/apache-airflow-providers-common-sql/1.13.0/changelog.html"
65
+ "Documentation" = "https://airflow.apache.org/docs/apache-airflow-providers-common-sql/1.14.0"
66
+ "Changelog" = "https://airflow.apache.org/docs/apache-airflow-providers-common-sql/1.14.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"