apache-airflow-providers-teradata 2.4.0__tar.gz → 2.5.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.
Potentially problematic release.
This version of apache-airflow-providers-teradata might be problematic. Click here for more details.
- {apache_airflow_providers_teradata-2.4.0 → apache_airflow_providers_teradata-2.5.0}/PKG-INFO +8 -8
- {apache_airflow_providers_teradata-2.4.0 → apache_airflow_providers_teradata-2.5.0}/README.rst +4 -4
- {apache_airflow_providers_teradata-2.4.0 → apache_airflow_providers_teradata-2.5.0}/airflow/providers/teradata/__init__.py +1 -1
- {apache_airflow_providers_teradata-2.4.0 → apache_airflow_providers_teradata-2.5.0}/airflow/providers/teradata/get_provider_info.py +3 -3
- {apache_airflow_providers_teradata-2.4.0 → apache_airflow_providers_teradata-2.5.0}/airflow/providers/teradata/hooks/teradata.py +56 -2
- {apache_airflow_providers_teradata-2.4.0 → apache_airflow_providers_teradata-2.5.0}/pyproject.toml +4 -4
- {apache_airflow_providers_teradata-2.4.0 → apache_airflow_providers_teradata-2.5.0}/airflow/providers/teradata/LICENSE +0 -0
- {apache_airflow_providers_teradata-2.4.0 → apache_airflow_providers_teradata-2.5.0}/airflow/providers/teradata/hooks/__init__.py +0 -0
- {apache_airflow_providers_teradata-2.4.0 → apache_airflow_providers_teradata-2.5.0}/airflow/providers/teradata/operators/__init__.py +0 -0
- {apache_airflow_providers_teradata-2.4.0 → apache_airflow_providers_teradata-2.5.0}/airflow/providers/teradata/operators/teradata.py +0 -0
- {apache_airflow_providers_teradata-2.4.0 → apache_airflow_providers_teradata-2.5.0}/airflow/providers/teradata/operators/teradata_compute_cluster.py +0 -0
- {apache_airflow_providers_teradata-2.4.0 → apache_airflow_providers_teradata-2.5.0}/airflow/providers/teradata/transfers/__init__.py +0 -0
- {apache_airflow_providers_teradata-2.4.0 → apache_airflow_providers_teradata-2.5.0}/airflow/providers/teradata/transfers/azure_blob_to_teradata.py +0 -0
- {apache_airflow_providers_teradata-2.4.0 → apache_airflow_providers_teradata-2.5.0}/airflow/providers/teradata/transfers/s3_to_teradata.py +0 -0
- {apache_airflow_providers_teradata-2.4.0 → apache_airflow_providers_teradata-2.5.0}/airflow/providers/teradata/transfers/teradata_to_teradata.py +0 -0
- {apache_airflow_providers_teradata-2.4.0 → apache_airflow_providers_teradata-2.5.0}/airflow/providers/teradata/triggers/__init__.py +0 -0
- {apache_airflow_providers_teradata-2.4.0 → apache_airflow_providers_teradata-2.5.0}/airflow/providers/teradata/triggers/teradata_compute_cluster.py +0 -0
- {apache_airflow_providers_teradata-2.4.0 → apache_airflow_providers_teradata-2.5.0}/airflow/providers/teradata/utils/__init__.py +0 -0
- {apache_airflow_providers_teradata-2.4.0 → apache_airflow_providers_teradata-2.5.0}/airflow/providers/teradata/utils/constants.py +0 -0
{apache_airflow_providers_teradata-2.4.0 → apache_airflow_providers_teradata-2.5.0}/PKG-INFO
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: apache-airflow-providers-teradata
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.5.0
|
|
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>
|
|
@@ -21,7 +21,7 @@ Classifier: Programming Language :: Python :: 3.10
|
|
|
21
21
|
Classifier: Programming Language :: Python :: 3.11
|
|
22
22
|
Classifier: Programming Language :: Python :: 3.12
|
|
23
23
|
Classifier: Topic :: System :: Monitoring
|
|
24
|
-
Requires-Dist: apache-airflow-providers-common-sql>=1.
|
|
24
|
+
Requires-Dist: apache-airflow-providers-common-sql>=1.14.1
|
|
25
25
|
Requires-Dist: apache-airflow>=2.7.0
|
|
26
26
|
Requires-Dist: teradatasql>=17.20.0.28
|
|
27
27
|
Requires-Dist: teradatasqlalchemy>=17.20.0.0
|
|
@@ -29,8 +29,8 @@ Requires-Dist: apache-airflow-providers-amazon ; extra == "amazon"
|
|
|
29
29
|
Requires-Dist: apache-airflow-providers-common-sql ; extra == "common.sql"
|
|
30
30
|
Requires-Dist: apache-airflow-providers-microsoft-azure ; extra == "microsoft.azure"
|
|
31
31
|
Project-URL: Bug Tracker, https://github.com/apache/airflow/issues
|
|
32
|
-
Project-URL: Changelog, https://airflow.apache.org/docs/apache-airflow-providers-teradata/2.
|
|
33
|
-
Project-URL: Documentation, https://airflow.apache.org/docs/apache-airflow-providers-teradata/2.
|
|
32
|
+
Project-URL: Changelog, https://airflow.apache.org/docs/apache-airflow-providers-teradata/2.5.0/changelog.html
|
|
33
|
+
Project-URL: Documentation, https://airflow.apache.org/docs/apache-airflow-providers-teradata/2.5.0
|
|
34
34
|
Project-URL: Slack Chat, https://s.apache.org/airflow-slack
|
|
35
35
|
Project-URL: Source Code, https://github.com/apache/airflow
|
|
36
36
|
Project-URL: Twitter, https://twitter.com/ApacheAirflow
|
|
@@ -83,7 +83,7 @@ Provides-Extra: microsoft.azure
|
|
|
83
83
|
|
|
84
84
|
Package ``apache-airflow-providers-teradata``
|
|
85
85
|
|
|
86
|
-
Release: ``2.
|
|
86
|
+
Release: ``2.5.0``
|
|
87
87
|
|
|
88
88
|
|
|
89
89
|
`Teradata <https://www.teradata.com/>`__
|
|
@@ -96,7 +96,7 @@ This is a provider package for ``teradata`` provider. All classes for this provi
|
|
|
96
96
|
are in ``airflow.providers.teradata`` python package.
|
|
97
97
|
|
|
98
98
|
You can find package information and changelog for the provider
|
|
99
|
-
in the `documentation <https://airflow.apache.org/docs/apache-airflow-providers-teradata/2.
|
|
99
|
+
in the `documentation <https://airflow.apache.org/docs/apache-airflow-providers-teradata/2.5.0/>`_.
|
|
100
100
|
|
|
101
101
|
Installation
|
|
102
102
|
------------
|
|
@@ -114,7 +114,7 @@ Requirements
|
|
|
114
114
|
PIP package Version required
|
|
115
115
|
======================================= ==================
|
|
116
116
|
``apache-airflow`` ``>=2.7.0``
|
|
117
|
-
``apache-airflow-providers-common-sql`` ``>=1.
|
|
117
|
+
``apache-airflow-providers-common-sql`` ``>=1.14.1``
|
|
118
118
|
``teradatasqlalchemy`` ``>=17.20.0.0``
|
|
119
119
|
``teradatasql`` ``>=17.20.0.28``
|
|
120
120
|
======================================= ==================
|
|
@@ -141,4 +141,4 @@ Dependent package
|
|
|
141
141
|
====================================================================================================================== ===================
|
|
142
142
|
|
|
143
143
|
The changelog for the provider package can be found in the
|
|
144
|
-
`changelog <https://airflow.apache.org/docs/apache-airflow-providers-teradata/2.
|
|
144
|
+
`changelog <https://airflow.apache.org/docs/apache-airflow-providers-teradata/2.5.0/changelog.html>`_.
|
{apache_airflow_providers_teradata-2.4.0 → apache_airflow_providers_teradata-2.5.0}/README.rst
RENAMED
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
|
|
43
43
|
Package ``apache-airflow-providers-teradata``
|
|
44
44
|
|
|
45
|
-
Release: ``2.
|
|
45
|
+
Release: ``2.5.0``
|
|
46
46
|
|
|
47
47
|
|
|
48
48
|
`Teradata <https://www.teradata.com/>`__
|
|
@@ -55,7 +55,7 @@ This is a provider package for ``teradata`` provider. All classes for this provi
|
|
|
55
55
|
are in ``airflow.providers.teradata`` 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-teradata/2.
|
|
58
|
+
in the `documentation <https://airflow.apache.org/docs/apache-airflow-providers-teradata/2.5.0/>`_.
|
|
59
59
|
|
|
60
60
|
Installation
|
|
61
61
|
------------
|
|
@@ -73,7 +73,7 @@ Requirements
|
|
|
73
73
|
PIP package Version required
|
|
74
74
|
======================================= ==================
|
|
75
75
|
``apache-airflow`` ``>=2.7.0``
|
|
76
|
-
``apache-airflow-providers-common-sql`` ``>=1.
|
|
76
|
+
``apache-airflow-providers-common-sql`` ``>=1.14.1``
|
|
77
77
|
``teradatasqlalchemy`` ``>=17.20.0.0``
|
|
78
78
|
``teradatasql`` ``>=17.20.0.28``
|
|
79
79
|
======================================= ==================
|
|
@@ -100,4 +100,4 @@ Dependent package
|
|
|
100
100
|
====================================================================================================================== ===================
|
|
101
101
|
|
|
102
102
|
The changelog for the provider package can be found in the
|
|
103
|
-
`changelog <https://airflow.apache.org/docs/apache-airflow-providers-teradata/2.
|
|
103
|
+
`changelog <https://airflow.apache.org/docs/apache-airflow-providers-teradata/2.5.0/changelog.html>`_.
|
|
@@ -29,7 +29,7 @@ from airflow import __version__ as airflow_version
|
|
|
29
29
|
|
|
30
30
|
__all__ = ["__version__"]
|
|
31
31
|
|
|
32
|
-
__version__ = "2.
|
|
32
|
+
__version__ = "2.5.0"
|
|
33
33
|
|
|
34
34
|
if packaging.version.parse(packaging.version.parse(airflow_version).base_version) < packaging.version.parse(
|
|
35
35
|
"2.7.0"
|
|
@@ -28,11 +28,11 @@ 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":
|
|
32
|
-
"versions": ["2.4.0", "2.3.0", "2.2.0", "2.1.1", "2.1.0", "2.0.0"],
|
|
31
|
+
"source-date-epoch": 1722664913,
|
|
32
|
+
"versions": ["2.5.0", "2.4.0", "2.3.0", "2.2.0", "2.1.1", "2.1.0", "2.0.0"],
|
|
33
33
|
"dependencies": [
|
|
34
34
|
"apache-airflow>=2.7.0",
|
|
35
|
-
"apache-airflow-providers-common-sql>=1.
|
|
35
|
+
"apache-airflow-providers-common-sql>=1.14.1",
|
|
36
36
|
"teradatasqlalchemy>=17.20.0.0",
|
|
37
37
|
"teradatasql>=17.20.0.28",
|
|
38
38
|
],
|
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
|
|
20
20
|
from __future__ import annotations
|
|
21
21
|
|
|
22
|
+
import re
|
|
22
23
|
import warnings
|
|
23
24
|
from typing import TYPE_CHECKING, Any
|
|
24
25
|
|
|
@@ -44,6 +45,42 @@ def _map_param(value):
|
|
|
44
45
|
return value
|
|
45
46
|
|
|
46
47
|
|
|
48
|
+
def _handle_user_query_band_text(query_band_text) -> str:
|
|
49
|
+
"""Validate given query_band and append if required values missed in query_band."""
|
|
50
|
+
# Ensures 'appname=airflow' and 'org=teradata-internal-telem' are in query_band_text.
|
|
51
|
+
if query_band_text is not None:
|
|
52
|
+
# checking org doesn't exist in query_band, appending 'org=teradata-internal-telem'
|
|
53
|
+
# If it exists, user might have set some value of their own, so doing nothing in that case
|
|
54
|
+
pattern = r"org\s*=\s*([^;]*)"
|
|
55
|
+
match = re.search(pattern, query_band_text)
|
|
56
|
+
if not match:
|
|
57
|
+
if not query_band_text.endswith(";"):
|
|
58
|
+
query_band_text += ";"
|
|
59
|
+
query_band_text += "org=teradata-internal-telem;"
|
|
60
|
+
# Making sure appname in query_band contains 'airflow'
|
|
61
|
+
pattern = r"appname\s*=\s*([^;]*)"
|
|
62
|
+
# Search for the pattern in the query_band_text
|
|
63
|
+
match = re.search(pattern, query_band_text)
|
|
64
|
+
if match:
|
|
65
|
+
appname_value = match.group(1).strip()
|
|
66
|
+
# if appname exists and airflow not exists in appname then appending 'airflow' to existing
|
|
67
|
+
# appname value
|
|
68
|
+
if "airflow" not in appname_value.lower():
|
|
69
|
+
new_appname_value = appname_value + "_airflow"
|
|
70
|
+
# Optionally, you can replace the original value in the query_band_text
|
|
71
|
+
updated_query_band_text = re.sub(pattern, f"appname={new_appname_value}", query_band_text)
|
|
72
|
+
query_band_text = updated_query_band_text
|
|
73
|
+
else:
|
|
74
|
+
# if appname doesn't exist in query_band, adding 'appname=airflow'
|
|
75
|
+
if len(query_band_text.strip()) > 0 and not query_band_text.endswith(";"):
|
|
76
|
+
query_band_text += ";"
|
|
77
|
+
query_band_text += "appname=airflow;"
|
|
78
|
+
else:
|
|
79
|
+
query_band_text = "org=teradata-internal-telem;appname=airflow;"
|
|
80
|
+
|
|
81
|
+
return query_band_text
|
|
82
|
+
|
|
83
|
+
|
|
47
84
|
class TeradataHook(DbApiHook):
|
|
48
85
|
"""
|
|
49
86
|
General hook for interacting with Teradata SQL Database.
|
|
@@ -105,9 +142,24 @@ class TeradataHook(DbApiHook):
|
|
|
105
142
|
:return: a Teradata connection object
|
|
106
143
|
"""
|
|
107
144
|
teradata_conn_config: dict = self._get_conn_config_teradatasql()
|
|
145
|
+
query_band_text = None
|
|
146
|
+
if "query_band" in teradata_conn_config:
|
|
147
|
+
query_band_text = teradata_conn_config.pop("query_band")
|
|
108
148
|
teradata_conn = teradatasql.connect(**teradata_conn_config)
|
|
149
|
+
# setting query band
|
|
150
|
+
self.set_query_band(query_band_text, teradata_conn)
|
|
109
151
|
return teradata_conn
|
|
110
152
|
|
|
153
|
+
def set_query_band(self, query_band_text, teradata_conn):
|
|
154
|
+
"""Set SESSION Query Band for each connection session."""
|
|
155
|
+
try:
|
|
156
|
+
query_band_text = _handle_user_query_band_text(query_band_text)
|
|
157
|
+
set_query_band_sql = f"SET QUERY_BAND='{query_band_text}' FOR SESSION"
|
|
158
|
+
with teradata_conn.cursor() as cur:
|
|
159
|
+
cur.execute(set_query_band_sql)
|
|
160
|
+
except Exception as ex:
|
|
161
|
+
self.log.error("Error occurred while setting session query band: %s ", str(ex))
|
|
162
|
+
|
|
111
163
|
def bulk_insert_rows(
|
|
112
164
|
self,
|
|
113
165
|
table: str,
|
|
@@ -144,7 +196,7 @@ class TeradataHook(DbApiHook):
|
|
|
144
196
|
|
|
145
197
|
def _get_conn_config_teradatasql(self) -> dict[str, Any]:
|
|
146
198
|
"""Return set of config params required for connecting to Teradata DB using teradatasql client."""
|
|
147
|
-
conn: Connection = self.get_connection(
|
|
199
|
+
conn: Connection = self.get_connection(self.get_conn_id())
|
|
148
200
|
conn_config = {
|
|
149
201
|
"host": conn.host or "localhost",
|
|
150
202
|
"dbs_port": conn.port or "1025",
|
|
@@ -171,12 +223,14 @@ class TeradataHook(DbApiHook):
|
|
|
171
223
|
conn_config["sslcrc"] = conn.extra_dejson["sslcrc"]
|
|
172
224
|
if conn.extra_dejson.get("sslprotocol", False):
|
|
173
225
|
conn_config["sslprotocol"] = conn.extra_dejson["sslprotocol"]
|
|
226
|
+
if conn.extra_dejson.get("query_band", False):
|
|
227
|
+
conn_config["query_band"] = conn.extra_dejson["query_band"]
|
|
174
228
|
|
|
175
229
|
return conn_config
|
|
176
230
|
|
|
177
231
|
def get_sqlalchemy_engine(self, engine_kwargs=None):
|
|
178
232
|
"""Return a connection object using sqlalchemy."""
|
|
179
|
-
conn: Connection = self.get_connection(
|
|
233
|
+
conn: Connection = self.get_connection(self.get_conn_id())
|
|
180
234
|
link = f"teradatasql://{conn.login}:{conn.password}@{conn.host}"
|
|
181
235
|
connection = sqlalchemy.create_engine(link)
|
|
182
236
|
return connection
|
{apache_airflow_providers_teradata-2.4.0 → apache_airflow_providers_teradata-2.5.0}/pyproject.toml
RENAMED
|
@@ -28,7 +28,7 @@ build-backend = "flit_core.buildapi"
|
|
|
28
28
|
|
|
29
29
|
[project]
|
|
30
30
|
name = "apache-airflow-providers-teradata"
|
|
31
|
-
version = "2.
|
|
31
|
+
version = "2.5.0"
|
|
32
32
|
description = "Provider package apache-airflow-providers-teradata for Apache Airflow"
|
|
33
33
|
readme = "README.rst"
|
|
34
34
|
authors = [
|
|
@@ -56,15 +56,15 @@ classifiers = [
|
|
|
56
56
|
]
|
|
57
57
|
requires-python = "~=3.8"
|
|
58
58
|
dependencies = [
|
|
59
|
-
"apache-airflow-providers-common-sql>=1.
|
|
59
|
+
"apache-airflow-providers-common-sql>=1.14.1",
|
|
60
60
|
"apache-airflow>=2.7.0",
|
|
61
61
|
"teradatasql>=17.20.0.28",
|
|
62
62
|
"teradatasqlalchemy>=17.20.0.0",
|
|
63
63
|
]
|
|
64
64
|
|
|
65
65
|
[project.urls]
|
|
66
|
-
"Documentation" = "https://airflow.apache.org/docs/apache-airflow-providers-teradata/2.
|
|
67
|
-
"Changelog" = "https://airflow.apache.org/docs/apache-airflow-providers-teradata/2.
|
|
66
|
+
"Documentation" = "https://airflow.apache.org/docs/apache-airflow-providers-teradata/2.5.0"
|
|
67
|
+
"Changelog" = "https://airflow.apache.org/docs/apache-airflow-providers-teradata/2.5.0/changelog.html"
|
|
68
68
|
"Bug Tracker" = "https://github.com/apache/airflow/issues"
|
|
69
69
|
"Source Code" = "https://github.com/apache/airflow"
|
|
70
70
|
"Slack Chat" = "https://s.apache.org/airflow-slack"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|