apache-airflow-providers-teradata 2.0.0rc1__py3-none-any.whl → 2.1.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.

Potentially problematic release.


This version of apache-airflow-providers-teradata might be problematic. Click here for more details.

@@ -27,7 +27,7 @@ import packaging.version
27
27
 
28
28
  __all__ = ["__version__"]
29
29
 
30
- __version__ = "2.0.0"
30
+ __version__ = "2.1.0"
31
31
 
32
32
  try:
33
33
  from airflow import __version__ as airflow_version
@@ -35,8 +35,8 @@ except ImportError:
35
35
  from airflow.version import version as airflow_version
36
36
 
37
37
  if packaging.version.parse(packaging.version.parse(airflow_version).base_version) < packaging.version.parse(
38
- "2.6.0"
38
+ "2.7.0"
39
39
  ):
40
40
  raise RuntimeError(
41
- f"The package `apache-airflow-providers-teradata:{__version__}` needs Apache Airflow 2.6.0+"
41
+ f"The package `apache-airflow-providers-teradata:{__version__}` needs Apache Airflow 2.7.0+"
42
42
  )
@@ -28,10 +28,10 @@ def get_provider_info():
28
28
  "name": "Teradata",
29
29
  "description": "`Teradata <https://www.teradata.com/>`__\n",
30
30
  "state": "ready",
31
- "source-date-epoch": 1700148082,
32
- "versions": ["2.0.0"],
31
+ "source-date-epoch": 1714477702,
32
+ "versions": ["2.1.0", "2.0.0"],
33
33
  "dependencies": [
34
- "apache-airflow>=2.6.0",
34
+ "apache-airflow>=2.7.0",
35
35
  "apache-airflow-providers-common-sql>=1.3.1",
36
36
  "teradatasqlalchemy>=17.20.0.0",
37
37
  "teradatasql>=17.20.0.28",
@@ -16,14 +16,17 @@
16
16
  # specific language governing permissions and limitations
17
17
  # under the License.
18
18
  """An Airflow Hook for interacting with Teradata SQL Server."""
19
+
19
20
  from __future__ import annotations
20
21
 
22
+ import warnings
21
23
  from typing import TYPE_CHECKING, Any
22
24
 
23
25
  import sqlalchemy
24
26
  import teradatasql
25
27
  from teradatasql import TeradataConnection
26
28
 
29
+ from airflow.exceptions import AirflowProviderDeprecationWarning
27
30
  from airflow.providers.common.sql.hooks.sql import DbApiHook
28
31
 
29
32
  if TYPE_CHECKING:
@@ -58,6 +61,9 @@ class TeradataHook(DbApiHook):
58
61
  # Override if this db supports autocommit.
59
62
  supports_autocommit = True
60
63
 
64
+ # Override if this db supports executemany.
65
+ supports_executemany = True
66
+
61
67
  # Override this for hook to have a custom name in the UI selection
62
68
  conn_type = "teradata"
63
69
 
@@ -96,7 +102,9 @@ class TeradataHook(DbApiHook):
96
102
  target_fields: list[str] | None = None,
97
103
  commit_every: int = 5000,
98
104
  ):
99
- """Insert bulk of records into Teradata SQL Database.
105
+ """Use :func:`insert_rows` instead, this is deprecated.
106
+
107
+ Insert bulk of records into Teradata SQL Database.
100
108
 
101
109
  This uses prepared statements via `executemany()`. For best performance,
102
110
  pass in `rows` as an iterator.
@@ -105,41 +113,20 @@ class TeradataHook(DbApiHook):
105
113
  specific database
106
114
  :param rows: the rows to insert into the table
107
115
  :param target_fields: the names of the columns to fill in the table, default None.
108
- If None, each rows should have some order as table columns name
116
+ If None, each row should have some order as table columns name
109
117
  :param commit_every: the maximum number of rows to insert in one transaction
110
118
  Default 5000. Set greater than 0. Set 1 to insert each row in each transaction
111
119
  """
120
+ warnings.warn(
121
+ "bulk_insert_rows is deprecated. Please use the insert_rows method instead.",
122
+ AirflowProviderDeprecationWarning,
123
+ stacklevel=2,
124
+ )
125
+
112
126
  if not rows:
113
127
  raise ValueError("parameter rows could not be None or empty iterable")
114
- conn = self.get_conn()
115
- if self.supports_autocommit:
116
- self.set_autocommit(conn, False)
117
- cursor = conn.cursor()
118
- cursor.fast_executemany = True
119
- values_base = target_fields if target_fields else rows[0]
120
- prepared_stm = "INSERT INTO {tablename} {columns} VALUES ({values})".format(
121
- tablename=table,
122
- columns="({})".format(", ".join(target_fields)) if target_fields else "",
123
- values=", ".join("?" for i in range(1, len(values_base) + 1)),
124
- )
125
- row_count = 0
126
- # Chunk the rows
127
- row_chunk = []
128
- for row in rows:
129
- row_chunk.append(row)
130
- row_count += 1
131
- if row_count % commit_every == 0:
132
- cursor.executemany(prepared_stm, row_chunk)
133
- conn.commit() # type: ignore[attr-defined]
134
- # Empty chunk
135
- row_chunk = []
136
- # Commit the leftover chunk
137
- if len(row_chunk) > 0:
138
- cursor.executemany(prepared_stm, row_chunk)
139
- conn.commit() # type: ignore[attr-defined]
140
- self.log.info("[%s] inserted %s rows", table, row_count)
141
- cursor.close()
142
- conn.close() # type: ignore[attr-defined]
128
+
129
+ self.insert_rows(table=table, rows=rows, target_fields=target_fields, commit_every=commit_every)
143
130
 
144
131
  def _get_conn_config_teradatasql(self) -> dict[str, Any]:
145
132
  """Return set of config params required for connecting to Teradata DB using teradatasql client."""
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: apache-airflow-providers-teradata
3
- Version: 2.0.0rc1
3
+ Version: 2.1.0rc1
4
4
  Summary: Provider package apache-airflow-providers-teradata for Apache Airflow
5
5
  Keywords: airflow-provider,teradata,airflow,integration
6
6
  Author-email: Apache Software Foundation <dev@airflow.apache.org>
@@ -19,15 +19,16 @@ Classifier: Programming Language :: Python :: 3.8
19
19
  Classifier: Programming Language :: Python :: 3.9
20
20
  Classifier: Programming Language :: Python :: 3.10
21
21
  Classifier: Programming Language :: Python :: 3.11
22
+ Classifier: Programming Language :: Python :: 3.12
22
23
  Classifier: Topic :: System :: Monitoring
23
- Requires-Dist: apache-airflow-providers-common-sql>=1.3.1.dev0
24
- Requires-Dist: apache-airflow>=2.6.0.dev0
24
+ Requires-Dist: apache-airflow-providers-common-sql>=1.3.1rc0
25
+ Requires-Dist: apache-airflow>=2.7.0rc0
25
26
  Requires-Dist: teradatasql>=17.20.0.28
26
27
  Requires-Dist: teradatasqlalchemy>=17.20.0.0
27
28
  Requires-Dist: apache-airflow-providers-common-sql ; extra == "common.sql"
28
29
  Project-URL: Bug Tracker, https://github.com/apache/airflow/issues
29
- Project-URL: Changelog, https://airflow.apache.org/docs/apache-airflow-providers-teradata/2.0.0/changelog.html
30
- Project-URL: Documentation, https://airflow.apache.org/docs/apache-airflow-providers-teradata/2.0.0
30
+ Project-URL: Changelog, https://airflow.apache.org/docs/apache-airflow-providers-teradata/2.1.0/changelog.html
31
+ Project-URL: Documentation, https://airflow.apache.org/docs/apache-airflow-providers-teradata/2.1.0
31
32
  Project-URL: Slack Chat, https://s.apache.org/airflow-slack
32
33
  Project-URL: Source Code, https://github.com/apache/airflow
33
34
  Project-URL: Twitter, https://twitter.com/ApacheAirflow
@@ -78,7 +79,7 @@ Provides-Extra: common.sql
78
79
 
79
80
  Package ``apache-airflow-providers-teradata``
80
81
 
81
- Release: ``2.0.0.rc1``
82
+ Release: ``2.1.0.rc1``
82
83
 
83
84
 
84
85
  `Teradata <https://www.teradata.com/>`__
@@ -91,7 +92,7 @@ This is a provider package for ``teradata`` provider. All classes for this provi
91
92
  are in ``airflow.providers.teradata`` python package.
92
93
 
93
94
  You can find package information and changelog for the provider
94
- in the `documentation <https://airflow.apache.org/docs/apache-airflow-providers-teradata/2.0.0/>`_.
95
+ in the `documentation <https://airflow.apache.org/docs/apache-airflow-providers-teradata/2.1.0/>`_.
95
96
 
96
97
  Installation
97
98
  ------------
@@ -100,7 +101,7 @@ You can install this package on top of an existing Airflow 2 installation (see `
100
101
  for the minimum Airflow version supported) via
101
102
  ``pip install apache-airflow-providers-teradata``
102
103
 
103
- The package supports the following python versions: 3.8,3.9,3.10,3.11
104
+ The package supports the following python versions: 3.8,3.9,3.10,3.11,3.12
104
105
 
105
106
  Requirements
106
107
  ------------
@@ -108,7 +109,7 @@ Requirements
108
109
  ======================================= ==================
109
110
  PIP package Version required
110
111
  ======================================= ==================
111
- ``apache-airflow`` ``>=2.6.0``
112
+ ``apache-airflow`` ``>=2.7.0``
112
113
  ``apache-airflow-providers-common-sql`` ``>=1.3.1``
113
114
  ``teradatasqlalchemy`` ``>=17.20.0.0``
114
115
  ``teradatasql`` ``>=17.20.0.28``
@@ -134,4 +135,4 @@ Dependent package
134
135
  ============================================================================================================ ==============
135
136
 
136
137
  The changelog for the provider package can be found in the
137
- `changelog <https://airflow.apache.org/docs/apache-airflow-providers-teradata/2.0.0/changelog.html>`_.
138
+ `changelog <https://airflow.apache.org/docs/apache-airflow-providers-teradata/2.1.0/changelog.html>`_.
@@ -1,13 +1,13 @@
1
1
  airflow/providers/teradata/LICENSE,sha256=ywUBpKZc7Jb96rVt5I3IDbg7dIJAbUSHkuoDcF3jbH4,13569
2
- airflow/providers/teradata/__init__.py,sha256=RV5q0cL-SrYdknuU-pF-iEKaPMaVq_IeH3_tcjc6o60,1583
3
- airflow/providers/teradata/get_provider_info.py,sha256=qOUPkhJIwdFfTsm926Ub8yacOBDIJ-lWWZ6NG2H6vBM,2872
2
+ airflow/providers/teradata/__init__.py,sha256=Qx5ibi1KuYW7-iUwF99s0wCc7kdyuX4tNqtoRTZsAVo,1583
3
+ airflow/providers/teradata/get_provider_info.py,sha256=G11m0vQYXtr7UibbCmtfV87xEiAA--Fl2nXhGxtIdIY,2881
4
4
  airflow/providers/teradata/hooks/__init__.py,sha256=mlJxuZLkd5x-iq2SBwD3mvRQpt3YR7wjz_nceyF1IaI,787
5
- airflow/providers/teradata/hooks/teradata.py,sha256=LTV18WhtmXbc9pgKlhuLdICbSArVrTBVaO3O8uW3GlQ,8094
5
+ airflow/providers/teradata/hooks/teradata.py,sha256=cKK2X4hw0SQ0-tLun8C34jF_0Y-ftmbiwPQRoeRwCHo,7386
6
6
  airflow/providers/teradata/operators/__init__.py,sha256=mlJxuZLkd5x-iq2SBwD3mvRQpt3YR7wjz_nceyF1IaI,787
7
7
  airflow/providers/teradata/operators/teradata.py,sha256=UqEH6bn0e9NJgjBVVXgM-lQj-50MigBeJyWlbJ-1WG8,2373
8
8
  airflow/providers/teradata/transfers/__init__.py,sha256=9hdXHABrVpkbpjZgUft39kOFL2xSGeG4GEua0Hmelus,785
9
9
  airflow/providers/teradata/transfers/teradata_to_teradata.py,sha256=WketoakWYtYdMn7W3hR55otQJqQSKB_dKHTtYLc4mco,3834
10
- apache_airflow_providers_teradata-2.0.0rc1.dist-info/entry_points.txt,sha256=JbigXoUoKVSNWG-_-029FCCuehMOmAvuSnNGZ9Bz1Kc,104
11
- apache_airflow_providers_teradata-2.0.0rc1.dist-info/WHEEL,sha256=EZbGkh7Ie4PoZfRQ8I0ZuP9VklN_TvcZ6DSE5Uar4z4,81
12
- apache_airflow_providers_teradata-2.0.0rc1.dist-info/METADATA,sha256=ypjProhQmuoOm4qVfbbreZJ2MlaQY20EXrtAfWXML8g,6208
13
- apache_airflow_providers_teradata-2.0.0rc1.dist-info/RECORD,,
10
+ apache_airflow_providers_teradata-2.1.0rc1.dist-info/entry_points.txt,sha256=JbigXoUoKVSNWG-_-029FCCuehMOmAvuSnNGZ9Bz1Kc,104
11
+ apache_airflow_providers_teradata-2.1.0rc1.dist-info/WHEEL,sha256=EZbGkh7Ie4PoZfRQ8I0ZuP9VklN_TvcZ6DSE5Uar4z4,81
12
+ apache_airflow_providers_teradata-2.1.0rc1.dist-info/METADATA,sha256=CXAPxzeDrUUpRxOVeHwko3k01sw9TeBXDqRDzotJ7ac,6260
13
+ apache_airflow_providers_teradata-2.1.0rc1.dist-info/RECORD,,