apache-airflow-providers-vertica 3.5.1rc1__py3-none-any.whl → 3.6.0rc1__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.
@@ -28,7 +28,7 @@ import packaging.version
28
28
 
29
29
  __all__ = ["__version__"]
30
30
 
31
- __version__ = "3.5.1"
31
+ __version__ = "3.6.0"
32
32
 
33
33
  try:
34
34
  from airflow import __version__ as airflow_version
@@ -36,8 +36,8 @@ except ImportError:
36
36
  from airflow.version import version as airflow_version
37
37
 
38
38
  if packaging.version.parse(packaging.version.parse(airflow_version).base_version) < packaging.version.parse(
39
- "2.4.0"
39
+ "2.5.0"
40
40
  ):
41
41
  raise RuntimeError(
42
- f"The package `apache-airflow-providers-vertica:{__version__}` requires Apache Airflow 2.4.0+" # NOQA: E501
42
+ f"The package `apache-airflow-providers-vertica:{__version__}` requires Apache Airflow 2.5.0+" # NOQA: E501
43
43
  )
@@ -29,6 +29,8 @@ def get_provider_info():
29
29
  "description": "`Vertica <https://www.vertica.com/>`__\n",
30
30
  "suspended": False,
31
31
  "versions": [
32
+ "3.6.0",
33
+ "3.5.2",
32
34
  "3.5.1",
33
35
  "3.5.0",
34
36
  "3.4.1",
@@ -49,7 +51,7 @@ def get_provider_info():
49
51
  "1.0.0",
50
52
  ],
51
53
  "dependencies": [
52
- "apache-airflow>=2.4.0",
54
+ "apache-airflow>=2.5.0",
53
55
  "apache-airflow-providers-common-sql>=1.3.1",
54
56
  "vertica-python>=0.5.1",
55
57
  ],
@@ -17,13 +17,45 @@
17
17
  # under the License.
18
18
  from __future__ import annotations
19
19
 
20
+ from typing import Any, Callable, Iterable, Mapping, overload
21
+
20
22
  from vertica_python import connect
21
23
 
22
- from airflow.providers.common.sql.hooks.sql import DbApiHook
24
+ from airflow.providers.common.sql.hooks.sql import DbApiHook, fetch_all_handler
25
+
26
+
27
+ def vertica_fetch_all_handler(cursor) -> list[tuple] | None:
28
+ """
29
+ Replace the default DbApiHook fetch_all_handler in order to fix this issue https://github.com/apache/airflow/issues/32993.
30
+
31
+ Returned value will not change after the initial call of fetch_all_handler, all the remaining code is here
32
+ only to make vertica client throws error.
33
+ With Vertica, if you run the following sql (with split_statements set to false):
34
+
35
+ INSERT INTO MyTable (Key, Label) values (1, 'test 1');
36
+ INSERT INTO MyTable (Key, Label) values (1, 'test 2');
37
+ INSERT INTO MyTable (Key, Label) values (3, 'test 3');
38
+
39
+ each insert will have its own result set and if you don't try to fetch data of those result sets
40
+ you won't detect error on the second insert.
41
+ """
42
+ result = fetch_all_handler(cursor)
43
+ # loop on all statement result sets to get errors
44
+ if cursor.description is not None:
45
+ while cursor.nextset():
46
+ if cursor.description is not None:
47
+ row = cursor.fetchone()
48
+ while row:
49
+ row = cursor.fetchone()
50
+ return result
23
51
 
24
52
 
25
53
  class VerticaHook(DbApiHook):
26
- """Interact with Vertica."""
54
+ """
55
+ Interact with Vertica.
56
+
57
+ This hook use a customized version of default fetch_all_handler named vertica_fetch_all_handler.
58
+ """
27
59
 
28
60
  conn_name_attr = "vertica_conn_id"
29
61
  default_conn_name = "vertica_default"
@@ -32,7 +64,7 @@ class VerticaHook(DbApiHook):
32
64
  supports_autocommit = True
33
65
 
34
66
  def get_conn(self) -> connect:
35
- """Return verticaql connection object."""
67
+ """Return vertica connection object."""
36
68
  conn = self.get_connection(self.vertica_conn_id) # type: ignore
37
69
  conn_config = {
38
70
  "user": conn.login,
@@ -99,3 +131,45 @@ class VerticaHook(DbApiHook):
99
131
 
100
132
  conn = connect(**conn_config)
101
133
  return conn
134
+
135
+ @overload
136
+ def run(
137
+ self,
138
+ sql: str | Iterable[str],
139
+ autocommit: bool = ...,
140
+ parameters: Iterable | Mapping[str, Any] | None = ...,
141
+ handler: None = ...,
142
+ split_statements: bool = ...,
143
+ return_last: bool = ...,
144
+ ) -> None:
145
+ ...
146
+
147
+ @overload
148
+ def run(
149
+ self,
150
+ sql: str | Iterable[str],
151
+ autocommit: bool = ...,
152
+ parameters: Iterable | Mapping[str, Any] | None = ...,
153
+ handler: Callable[[Any], Any] = ...,
154
+ split_statements: bool = ...,
155
+ return_last: bool = ...,
156
+ ) -> Any | list[Any]:
157
+ ...
158
+
159
+ def run(
160
+ self,
161
+ sql: str | Iterable[str],
162
+ autocommit: bool = False,
163
+ parameters: Iterable | Mapping | None = None,
164
+ handler: Callable[[Any], Any] | None = None,
165
+ split_statements: bool = False,
166
+ return_last: bool = True,
167
+ ) -> Any | list[Any] | None:
168
+ """
169
+ Overwrite the common sql run.
170
+
171
+ Will automatically replace fetch_all_handler by vertica_fetch_all_handler.
172
+ """
173
+ if handler == fetch_all_handler:
174
+ handler = vertica_fetch_all_handler
175
+ return DbApiHook.run(self, sql, autocommit, parameters, handler, split_statements, return_last)
@@ -1,14 +1,14 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: apache-airflow-providers-vertica
3
- Version: 3.5.1rc1
3
+ Version: 3.6.0rc1
4
4
  Summary: Provider for Apache Airflow. Implements apache-airflow-providers-vertica package
5
5
  Home-page: https://airflow.apache.org/
6
6
  Download-URL: https://archive.apache.org/dist/airflow/providers
7
7
  Author: Apache Software Foundation
8
8
  Author-email: dev@airflow.apache.org
9
9
  License: Apache License 2.0
10
- Project-URL: Documentation, https://airflow.apache.org/docs/apache-airflow-providers-vertica/3.5.1/
11
- Project-URL: Changelog, https://airflow.apache.org/docs/apache-airflow-providers-vertica/3.5.1/changelog.html
10
+ Project-URL: Documentation, https://airflow.apache.org/docs/apache-airflow-providers-vertica/3.6.0/
11
+ Project-URL: Changelog, https://airflow.apache.org/docs/apache-airflow-providers-vertica/3.6.0/changelog.html
12
12
  Project-URL: Bug Tracker, https://github.com/apache/airflow/issues
13
13
  Project-URL: Source Code, https://github.com/apache/airflow
14
14
  Project-URL: Slack Chat, https://s.apache.org/airflow-slack
@@ -31,9 +31,9 @@ Requires-Python: ~=3.8
31
31
  Description-Content-Type: text/x-rst
32
32
  License-File: LICENSE
33
33
  License-File: NOTICE
34
- Requires-Dist: apache-airflow-providers-common-sql (>=1.3.1.dev0)
35
- Requires-Dist: apache-airflow (>=2.4.0.dev0)
36
- Requires-Dist: vertica-python (>=0.5.1)
34
+ Requires-Dist: apache-airflow-providers-common-sql >=1.3.1.dev0
35
+ Requires-Dist: apache-airflow >=2.5.0.dev0
36
+ Requires-Dist: vertica-python >=0.5.1
37
37
  Provides-Extra: common.sql
38
38
  Requires-Dist: apache-airflow-providers-common-sql ; extra == 'common.sql'
39
39
 
@@ -75,7 +75,7 @@ Requires-Dist: apache-airflow-providers-common-sql ; extra == 'common.sql'
75
75
 
76
76
  Package ``apache-airflow-providers-vertica``
77
77
 
78
- Release: ``3.5.1rc1``
78
+ Release: ``3.6.0rc1``
79
79
 
80
80
 
81
81
  `Vertica <https://www.vertica.com/>`__
@@ -88,7 +88,7 @@ This is a provider package for ``vertica`` provider. All classes for this provid
88
88
  are in ``airflow.providers.vertica`` python package.
89
89
 
90
90
  You can find package information and changelog for the provider
91
- in the `documentation <https://airflow.apache.org/docs/apache-airflow-providers-vertica/3.5.1/>`_.
91
+ in the `documentation <https://airflow.apache.org/docs/apache-airflow-providers-vertica/3.6.0/>`_.
92
92
 
93
93
 
94
94
  Installation
@@ -106,7 +106,7 @@ Requirements
106
106
  ======================================= ==================
107
107
  PIP package Version required
108
108
  ======================================= ==================
109
- ``apache-airflow`` ``>=2.4.0``
109
+ ``apache-airflow`` ``>=2.5.0``
110
110
  ``apache-airflow-providers-common-sql`` ``>=1.3.1``
111
111
  ``vertica-python`` ``>=0.5.1``
112
112
  ======================================= ==================
@@ -131,4 +131,4 @@ Dependent package
131
131
  ============================================================================================================ ==============
132
132
 
133
133
  The changelog for the provider package can be found in the
134
- `changelog <https://airflow.apache.org/docs/apache-airflow-providers-vertica/3.5.1/changelog.html>`_.
134
+ `changelog <https://airflow.apache.org/docs/apache-airflow-providers-vertica/3.6.0/changelog.html>`_.
@@ -0,0 +1,13 @@
1
+ airflow/providers/vertica/__init__.py,sha256=tWLW4xEuXg6PyZyEd8Vd99hJ985Gfx8j4YcYr8HDZFo,1576
2
+ airflow/providers/vertica/get_provider_info.py,sha256=j2E6J5oCGLJPeI0HHrPXg6Pk7yaQwuUPv5ybBaMvHFM,2638
3
+ airflow/providers/vertica/hooks/__init__.py,sha256=mlJxuZLkd5x-iq2SBwD3mvRQpt3YR7wjz_nceyF1IaI,787
4
+ airflow/providers/vertica/hooks/vertica.py,sha256=-9PmJdbA8qtwrFB325tlda4rgvWNi7Dhsmvf_3Fdxtw,6113
5
+ airflow/providers/vertica/operators/__init__.py,sha256=mlJxuZLkd5x-iq2SBwD3mvRQpt3YR7wjz_nceyF1IaI,787
6
+ airflow/providers/vertica/operators/vertica.py,sha256=giHtZBXlJWaasPsmmDdEZITgL4-DZkDcOMmpK-_FTpo,2100
7
+ apache_airflow_providers_vertica-3.6.0rc1.dist-info/LICENSE,sha256=gXPVwptPlW1TJ4HSuG5OMPg-a3h43OGMkZRR1rpwfJA,10850
8
+ apache_airflow_providers_vertica-3.6.0rc1.dist-info/METADATA,sha256=zgevyqDUJpPMOU_eyEetF7OgIZNDlinl7yX-Z2V3TCU,5872
9
+ apache_airflow_providers_vertica-3.6.0rc1.dist-info/NOTICE,sha256=m-6s2XynUxVSUIxO4rVablAZCvFq-wmLrqV91DotRBw,240
10
+ apache_airflow_providers_vertica-3.6.0rc1.dist-info/WHEEL,sha256=yQN5g4mg4AybRjkgi-9yy4iQEFibGQmlz78Pik5Or-A,92
11
+ apache_airflow_providers_vertica-3.6.0rc1.dist-info/entry_points.txt,sha256=0k7JMNI340DawjYhlJJ6Kc9QWXlWMKe88ZtF1zMU22U,104
12
+ apache_airflow_providers_vertica-3.6.0rc1.dist-info/top_level.txt,sha256=OeMVH5md7fr2QQWpnZoOWWxWO-0WH1IP70lpTVwopPg,8
13
+ apache_airflow_providers_vertica-3.6.0rc1.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: bdist_wheel (0.41.0)
2
+ Generator: bdist_wheel (0.41.2)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5
 
@@ -1,13 +0,0 @@
1
- airflow/providers/vertica/__init__.py,sha256=a94uZ5UDgJK3veQvG__JcOMQ6Sov-Bat7_hzGQYSMQw,1576
2
- airflow/providers/vertica/get_provider_info.py,sha256=0Fvo21cerVcidbhPe9gj8fVAJxnqpJ0ZBZeTHZBp76c,2596
3
- airflow/providers/vertica/hooks/__init__.py,sha256=mlJxuZLkd5x-iq2SBwD3mvRQpt3YR7wjz_nceyF1IaI,787
4
- airflow/providers/vertica/hooks/vertica.py,sha256=RGJJySiyTAgmdZGcfgLq21Wcnttr4cyWbnzcooNP6DY,3531
5
- airflow/providers/vertica/operators/__init__.py,sha256=mlJxuZLkd5x-iq2SBwD3mvRQpt3YR7wjz_nceyF1IaI,787
6
- airflow/providers/vertica/operators/vertica.py,sha256=giHtZBXlJWaasPsmmDdEZITgL4-DZkDcOMmpK-_FTpo,2100
7
- apache_airflow_providers_vertica-3.5.1rc1.dist-info/LICENSE,sha256=gXPVwptPlW1TJ4HSuG5OMPg-a3h43OGMkZRR1rpwfJA,10850
8
- apache_airflow_providers_vertica-3.5.1rc1.dist-info/METADATA,sha256=OfELVyAN9EYkuMwvtzMThHBbicdmUrC_gvoYT1M4xmk,5878
9
- apache_airflow_providers_vertica-3.5.1rc1.dist-info/NOTICE,sha256=m-6s2XynUxVSUIxO4rVablAZCvFq-wmLrqV91DotRBw,240
10
- apache_airflow_providers_vertica-3.5.1rc1.dist-info/WHEEL,sha256=AtBG6SXL3KF_v0NxLf0ehyVOh0cold-JbJYXNGorC6Q,92
11
- apache_airflow_providers_vertica-3.5.1rc1.dist-info/entry_points.txt,sha256=0k7JMNI340DawjYhlJJ6Kc9QWXlWMKe88ZtF1zMU22U,104
12
- apache_airflow_providers_vertica-3.5.1rc1.dist-info/top_level.txt,sha256=OeMVH5md7fr2QQWpnZoOWWxWO-0WH1IP70lpTVwopPg,8
13
- apache_airflow_providers_vertica-3.5.1rc1.dist-info/RECORD,,