apache-airflow-providers-mysql 5.6.2rc1__py3-none-any.whl → 6.4.1rc1__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-mysql might be problematic. Click here for more details.
- airflow/providers/mysql/__init__.py +3 -3
- airflow/providers/mysql/get_provider_info.py +6 -57
- airflow/providers/mysql/hooks/mysql.py +104 -24
- airflow/providers/mysql/transfers/presto_to_mysql.py +4 -3
- airflow/providers/mysql/transfers/s3_to_mysql.py +4 -3
- airflow/providers/mysql/transfers/trino_to_mysql.py +4 -3
- airflow/providers/mysql/transfers/vertica_to_mysql.py +29 -21
- airflow/providers/mysql/{operators/__init__.py → version_compat.py} +18 -1
- {apache_airflow_providers_mysql-5.6.2rc1.dist-info → apache_airflow_providers_mysql-6.4.1rc1.dist-info}/METADATA +61 -61
- apache_airflow_providers_mysql-6.4.1rc1.dist-info/RECORD +18 -0
- {apache_airflow_providers_mysql-5.6.2rc1.dist-info → apache_airflow_providers_mysql-6.4.1rc1.dist-info}/WHEEL +1 -1
- {airflow/providers/mysql → apache_airflow_providers_mysql-6.4.1rc1.dist-info/licenses}/LICENSE +0 -52
- apache_airflow_providers_mysql-6.4.1rc1.dist-info/licenses/NOTICE +5 -0
- airflow/providers/mysql/operators/mysql.py +0 -75
- apache_airflow_providers_mysql-5.6.2rc1.dist-info/RECORD +0 -18
- /airflow/providers/mysql/{datasets → assets}/__init__.py +0 -0
- /airflow/providers/mysql/{datasets → assets}/mysql.py +0 -0
- {apache_airflow_providers_mysql-5.6.2rc1.dist-info → apache_airflow_providers_mysql-6.4.1rc1.dist-info}/entry_points.txt +0 -0
|
@@ -29,11 +29,11 @@ from airflow import __version__ as airflow_version
|
|
|
29
29
|
|
|
30
30
|
__all__ = ["__version__"]
|
|
31
31
|
|
|
32
|
-
__version__ = "
|
|
32
|
+
__version__ = "6.4.1"
|
|
33
33
|
|
|
34
34
|
if packaging.version.parse(packaging.version.parse(airflow_version).base_version) < packaging.version.parse(
|
|
35
|
-
"2.
|
|
35
|
+
"2.11.0"
|
|
36
36
|
):
|
|
37
37
|
raise RuntimeError(
|
|
38
|
-
f"The package `apache-airflow-providers-mysql:{__version__}` needs Apache Airflow 2.
|
|
38
|
+
f"The package `apache-airflow-providers-mysql:{__version__}` needs Apache Airflow 2.11.0+"
|
|
39
39
|
)
|
|
@@ -15,8 +15,7 @@
|
|
|
15
15
|
# specific language governing permissions and limitations
|
|
16
16
|
# under the License.
|
|
17
17
|
|
|
18
|
-
# NOTE! THIS FILE IS AUTOMATICALLY GENERATED AND WILL BE
|
|
19
|
-
# OVERWRITTEN WHEN PREPARING PACKAGES.
|
|
18
|
+
# NOTE! THIS FILE IS AUTOMATICALLY GENERATED AND WILL BE OVERWRITTEN!
|
|
20
19
|
#
|
|
21
20
|
# IF YOU WANT TO MODIFY THIS FILE, YOU SHOULD MODIFY THE TEMPLATE
|
|
22
21
|
# `get_provider_info_TEMPLATE.py.jinja2` IN the `dev/breeze/src/airflow_breeze/templates` DIRECTORY
|
|
@@ -27,65 +26,15 @@ def get_provider_info():
|
|
|
27
26
|
"package-name": "apache-airflow-providers-mysql",
|
|
28
27
|
"name": "MySQL",
|
|
29
28
|
"description": "`MySQL <https://www.mysql.com/>`__\n",
|
|
30
|
-
"state": "ready",
|
|
31
|
-
"source-date-epoch": 1718605110,
|
|
32
|
-
"versions": [
|
|
33
|
-
"5.6.2",
|
|
34
|
-
"5.6.1",
|
|
35
|
-
"5.6.0",
|
|
36
|
-
"5.5.4",
|
|
37
|
-
"5.5.3",
|
|
38
|
-
"5.5.2",
|
|
39
|
-
"5.5.1",
|
|
40
|
-
"5.5.0",
|
|
41
|
-
"5.4.0",
|
|
42
|
-
"5.3.1",
|
|
43
|
-
"5.3.0",
|
|
44
|
-
"5.2.1",
|
|
45
|
-
"5.2.0",
|
|
46
|
-
"5.1.1",
|
|
47
|
-
"5.1.0",
|
|
48
|
-
"5.0.0",
|
|
49
|
-
"4.0.2",
|
|
50
|
-
"4.0.1",
|
|
51
|
-
"4.0.0",
|
|
52
|
-
"3.4.0",
|
|
53
|
-
"3.3.0",
|
|
54
|
-
"3.2.1",
|
|
55
|
-
"3.2.0",
|
|
56
|
-
"3.1.0",
|
|
57
|
-
"3.0.0",
|
|
58
|
-
"2.2.3",
|
|
59
|
-
"2.2.2",
|
|
60
|
-
"2.2.1",
|
|
61
|
-
"2.2.0",
|
|
62
|
-
"2.1.1",
|
|
63
|
-
"2.1.0",
|
|
64
|
-
"2.0.0",
|
|
65
|
-
"1.1.0",
|
|
66
|
-
"1.0.2",
|
|
67
|
-
"1.0.1",
|
|
68
|
-
"1.0.0",
|
|
69
|
-
],
|
|
70
|
-
"dependencies": [
|
|
71
|
-
"apache-airflow>=2.7.0",
|
|
72
|
-
"apache-airflow-providers-common-sql>=1.3.1",
|
|
73
|
-
"mysqlclient>=1.4.0",
|
|
74
|
-
"mysql-connector-python>=8.0.29",
|
|
75
|
-
],
|
|
76
|
-
"additional-extras": [{"name": "mysql-connector-python", "dependencies": []}],
|
|
77
29
|
"integrations": [
|
|
78
30
|
{
|
|
79
31
|
"integration-name": "MySQL",
|
|
80
32
|
"external-doc-url": "https://www.mysql.com/",
|
|
81
33
|
"how-to-guide": ["/docs/apache-airflow-providers-mysql/operators.rst"],
|
|
82
|
-
"logo": "/integration-logos/
|
|
34
|
+
"logo": "/docs/integration-logos/MySQL.png",
|
|
83
35
|
"tags": ["software"],
|
|
84
36
|
}
|
|
85
37
|
],
|
|
86
|
-
"operators": [
|
|
87
|
-
{"integration-name": "MySQL", "python-modules": ["airflow.providers.mysql.operators.mysql"]}
|
|
88
|
-
],
|
|
89
38
|
"hooks": [{"integration-name": "MySQL", "python-modules": ["airflow.providers.mysql.hooks.mysql"]}],
|
|
90
39
|
"transfers": [
|
|
91
40
|
{
|
|
@@ -112,10 +61,10 @@ def get_provider_info():
|
|
|
112
61
|
"connection-types": [
|
|
113
62
|
{"hook-class-name": "airflow.providers.mysql.hooks.mysql.MySqlHook", "connection-type": "mysql"}
|
|
114
63
|
],
|
|
64
|
+
"asset-uris": [
|
|
65
|
+
{"schemes": ["mysql", "mariadb"], "handler": "airflow.providers.mysql.assets.mysql.sanitize_uri"}
|
|
66
|
+
],
|
|
115
67
|
"dataset-uris": [
|
|
116
|
-
{
|
|
117
|
-
"schemes": ["mysql", "mariadb"],
|
|
118
|
-
"handler": "airflow.providers.mysql.datasets.mysql.sanitize_uri",
|
|
119
|
-
}
|
|
68
|
+
{"schemes": ["mysql", "mariadb"], "handler": "airflow.providers.mysql.assets.mysql.sanitize_uri"}
|
|
120
69
|
],
|
|
121
70
|
}
|
|
@@ -22,20 +22,29 @@ from __future__ import annotations
|
|
|
22
22
|
import json
|
|
23
23
|
import logging
|
|
24
24
|
from typing import TYPE_CHECKING, Any, Union
|
|
25
|
+
from urllib.parse import quote_plus, urlencode
|
|
25
26
|
|
|
26
|
-
from airflow.
|
|
27
|
+
from airflow.providers.common.compat.sdk import AirflowOptionalProviderFeatureException
|
|
27
28
|
from airflow.providers.common.sql.hooks.sql import DbApiHook
|
|
28
29
|
|
|
29
30
|
logger = logging.getLogger(__name__)
|
|
30
31
|
|
|
31
32
|
if TYPE_CHECKING:
|
|
32
|
-
from airflow.
|
|
33
|
+
from airflow.providers.common.compat.sdk import Connection
|
|
33
34
|
|
|
34
35
|
try:
|
|
35
36
|
from mysql.connector.abstracts import MySQLConnectionAbstract
|
|
36
37
|
except ModuleNotFoundError:
|
|
37
38
|
logger.warning("The package 'mysql-connector-python' is not installed. Import skipped")
|
|
38
|
-
|
|
39
|
+
try:
|
|
40
|
+
from MySQLdb.connections import Connection as MySQLdbConnection
|
|
41
|
+
except ImportError:
|
|
42
|
+
raise RuntimeError(
|
|
43
|
+
"You do not have `mysqlclient` package installed. "
|
|
44
|
+
"Please install it with `pip install mysqlclient` and make sure you have system "
|
|
45
|
+
"mysql libraries installed, as well as well as `pkg-config` system package "
|
|
46
|
+
"installed in case you see compilation error during installation."
|
|
47
|
+
)
|
|
39
48
|
|
|
40
49
|
MySQLConnectionTypes = Union["MySQLdbConnection", "MySQLConnectionAbstract"]
|
|
41
50
|
|
|
@@ -70,9 +79,8 @@ class MySqlHook(DbApiHook):
|
|
|
70
79
|
supports_autocommit = True
|
|
71
80
|
|
|
72
81
|
def __init__(self, *args, **kwargs) -> None:
|
|
73
|
-
super().__init__(*args, **kwargs)
|
|
82
|
+
super().__init__(*args, **{**kwargs, **{"escape_word_format": "`{}`"}})
|
|
74
83
|
self.schema = kwargs.pop("schema", None)
|
|
75
|
-
self.connection = kwargs.pop("connection", None)
|
|
76
84
|
self.local_infile = kwargs.pop("local_infile", False)
|
|
77
85
|
self.init_command = kwargs.pop("init_command", None)
|
|
78
86
|
|
|
@@ -103,8 +111,7 @@ class MySqlHook(DbApiHook):
|
|
|
103
111
|
"""
|
|
104
112
|
if hasattr(conn.__class__, "autocommit") and isinstance(conn.__class__.autocommit, property):
|
|
105
113
|
return conn.autocommit
|
|
106
|
-
|
|
107
|
-
return conn.get_autocommit() # type: ignore[union-attr]
|
|
114
|
+
return conn.get_autocommit() # type: ignore[union-attr]
|
|
108
115
|
|
|
109
116
|
def _get_conn_config_mysql_client(self, conn: Connection) -> dict:
|
|
110
117
|
conn_config = {
|
|
@@ -123,17 +130,30 @@ class MySqlHook(DbApiHook):
|
|
|
123
130
|
|
|
124
131
|
if conn.extra_dejson.get("charset", False):
|
|
125
132
|
conn_config["charset"] = conn.extra_dejson["charset"]
|
|
126
|
-
if conn_config
|
|
133
|
+
if str(conn_config.get("charset", "undef")).lower() in ("utf8", "utf-8"):
|
|
127
134
|
conn_config["use_unicode"] = True
|
|
128
135
|
if conn.extra_dejson.get("cursor", False):
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
136
|
+
try:
|
|
137
|
+
import MySQLdb.cursors
|
|
138
|
+
except ImportError:
|
|
139
|
+
raise RuntimeError(
|
|
140
|
+
"You do not have `mysqlclient` package installed. "
|
|
141
|
+
"Please install it with `pip install mysqlclient` and make sure you have system "
|
|
142
|
+
"mysql libraries installed, as well as well as `pkg-config` system package "
|
|
143
|
+
"installed in case you see compilation error during installation."
|
|
144
|
+
)
|
|
145
|
+
|
|
146
|
+
cursor_type = conn.extra_dejson.get("cursor", "").lower()
|
|
147
|
+
# Dictionary mapping cursor types to their respective classes
|
|
148
|
+
cursor_classes = {
|
|
149
|
+
"sscursor": MySQLdb.cursors.SSCursor,
|
|
150
|
+
"dictcursor": MySQLdb.cursors.DictCursor,
|
|
151
|
+
"ssdictcursor": MySQLdb.cursors.SSDictCursor,
|
|
152
|
+
}
|
|
153
|
+
# Set the cursor class in the connection configuration based on the cursor type
|
|
154
|
+
if cursor_type in cursor_classes:
|
|
155
|
+
conn_config["cursorclass"] = cursor_classes[cursor_type]
|
|
156
|
+
|
|
137
157
|
if conn.extra_dejson.get("ssl", False):
|
|
138
158
|
# SSL parameter for MySQL has to be a dictionary and in case
|
|
139
159
|
# of extra/dejson we can get string if extra is passed via
|
|
@@ -185,12 +205,20 @@ class MySqlHook(DbApiHook):
|
|
|
185
205
|
|
|
186
206
|
:return: a mysql connection object
|
|
187
207
|
"""
|
|
188
|
-
conn = self.connection or self.get_connection(
|
|
208
|
+
conn = self.connection or self.get_connection(self.get_conn_id())
|
|
189
209
|
|
|
190
210
|
client_name = conn.extra_dejson.get("client", "mysqlclient")
|
|
191
211
|
|
|
192
212
|
if client_name == "mysqlclient":
|
|
193
|
-
|
|
213
|
+
try:
|
|
214
|
+
import MySQLdb
|
|
215
|
+
except ImportError:
|
|
216
|
+
raise RuntimeError(
|
|
217
|
+
"You do not have `mysqlclient` package installed. "
|
|
218
|
+
"Please install it with `pip install mysqlclient` and make sure you have system "
|
|
219
|
+
"mysql libraries installed, as well as well as `pkg-config` system package "
|
|
220
|
+
"installed in case you see compilation error during installation."
|
|
221
|
+
)
|
|
194
222
|
|
|
195
223
|
conn_config = self._get_conn_config_mysql_client(conn)
|
|
196
224
|
return MySQLdb.connect(**conn_config)
|
|
@@ -212,25 +240,37 @@ class MySqlHook(DbApiHook):
|
|
|
212
240
|
|
|
213
241
|
def bulk_load(self, table: str, tmp_file: str) -> None:
|
|
214
242
|
"""Load a tab-delimited file into a database table."""
|
|
243
|
+
import re
|
|
244
|
+
|
|
215
245
|
conn = self.get_conn()
|
|
216
246
|
cur = conn.cursor()
|
|
247
|
+
|
|
248
|
+
if not re.fullmatch(r"^[a-zA-Z0-9_.]+$", table):
|
|
249
|
+
raise ValueError(f"Invalid table name: {table}")
|
|
250
|
+
|
|
217
251
|
cur.execute(
|
|
218
|
-
f"LOAD DATA LOCAL INFILE %s INTO TABLE {table}",
|
|
252
|
+
f"LOAD DATA LOCAL INFILE %s INTO TABLE `{table}`",
|
|
219
253
|
(tmp_file,),
|
|
220
254
|
)
|
|
221
255
|
conn.commit()
|
|
222
|
-
conn.close()
|
|
256
|
+
conn.close()
|
|
223
257
|
|
|
224
258
|
def bulk_dump(self, table: str, tmp_file: str) -> None:
|
|
225
259
|
"""Dump a database table into a tab-delimited file."""
|
|
260
|
+
import re
|
|
261
|
+
|
|
226
262
|
conn = self.get_conn()
|
|
227
263
|
cur = conn.cursor()
|
|
264
|
+
|
|
265
|
+
if not re.fullmatch(r"^[a-zA-Z0-9_.]+$", table):
|
|
266
|
+
raise ValueError(f"Invalid table name: {table}")
|
|
267
|
+
|
|
228
268
|
cur.execute(
|
|
229
|
-
f"SELECT * INTO OUTFILE %s FROM {table}",
|
|
269
|
+
f"SELECT * INTO OUTFILE %s FROM `{table}`",
|
|
230
270
|
(tmp_file,),
|
|
231
271
|
)
|
|
232
272
|
conn.commit()
|
|
233
|
-
conn.close()
|
|
273
|
+
conn.close()
|
|
234
274
|
|
|
235
275
|
@staticmethod
|
|
236
276
|
def _serialize_cell(cell: object, conn: Connection | None = None) -> Any:
|
|
@@ -291,13 +331,13 @@ class MySqlHook(DbApiHook):
|
|
|
291
331
|
cursor = conn.cursor()
|
|
292
332
|
|
|
293
333
|
cursor.execute(
|
|
294
|
-
f"LOAD DATA LOCAL INFILE %s %s INTO TABLE {table} %s",
|
|
334
|
+
f"LOAD DATA LOCAL INFILE %s %s INTO TABLE `{table}` %s",
|
|
295
335
|
(tmp_file, duplicate_key_handling, extra_options),
|
|
296
336
|
)
|
|
297
337
|
|
|
298
338
|
cursor.close()
|
|
299
339
|
conn.commit()
|
|
300
|
-
conn.close()
|
|
340
|
+
conn.close()
|
|
301
341
|
|
|
302
342
|
def get_openlineage_database_info(self, connection):
|
|
303
343
|
"""Return MySQL specific information for OpenLineage."""
|
|
@@ -323,3 +363,43 @@ class MySqlHook(DbApiHook):
|
|
|
323
363
|
def get_openlineage_default_schema(self):
|
|
324
364
|
"""MySQL has no concept of schema."""
|
|
325
365
|
return None
|
|
366
|
+
|
|
367
|
+
def get_uri(self) -> str:
|
|
368
|
+
"""Get URI for MySQL connection."""
|
|
369
|
+
conn = self.connection or self.get_connection(self.get_conn_id())
|
|
370
|
+
conn_schema = self.schema or conn.schema or ""
|
|
371
|
+
client_name = conn.extra_dejson.get("client", "mysqlclient")
|
|
372
|
+
|
|
373
|
+
# Determine URI prefix based on client
|
|
374
|
+
if client_name == "mysql-connector-python":
|
|
375
|
+
uri_prefix = "mysql+mysqlconnector://"
|
|
376
|
+
elif client_name == "pymysql":
|
|
377
|
+
uri_prefix = "mysql+pymysql://"
|
|
378
|
+
else: # default: mysqlclient
|
|
379
|
+
uri_prefix = "mysql://"
|
|
380
|
+
|
|
381
|
+
auth_part = ""
|
|
382
|
+
if conn.login:
|
|
383
|
+
auth_part = quote_plus(conn.login)
|
|
384
|
+
if conn.password:
|
|
385
|
+
auth_part = f"{auth_part}:{quote_plus(conn.password)}"
|
|
386
|
+
auth_part = f"{auth_part}@"
|
|
387
|
+
|
|
388
|
+
host_part = conn.host or "localhost"
|
|
389
|
+
if conn.port:
|
|
390
|
+
host_part = f"{host_part}:{conn.port}"
|
|
391
|
+
|
|
392
|
+
schema_part = f"/{quote_plus(conn_schema)}" if conn_schema else ""
|
|
393
|
+
|
|
394
|
+
uri = f"{uri_prefix}{auth_part}{host_part}{schema_part}"
|
|
395
|
+
|
|
396
|
+
# Add extra connection parameters
|
|
397
|
+
extra = conn.extra_dejson.copy()
|
|
398
|
+
if "client" in extra:
|
|
399
|
+
extra.pop("client")
|
|
400
|
+
|
|
401
|
+
query_params = {k: str(v) for k, v in extra.items() if v}
|
|
402
|
+
if query_params:
|
|
403
|
+
uri = f"{uri}?{urlencode(query_params)}"
|
|
404
|
+
|
|
405
|
+
return uri
|
|
@@ -17,14 +17,15 @@
|
|
|
17
17
|
# under the License.
|
|
18
18
|
from __future__ import annotations
|
|
19
19
|
|
|
20
|
-
from
|
|
20
|
+
from collections.abc import Sequence
|
|
21
|
+
from typing import TYPE_CHECKING
|
|
21
22
|
|
|
22
|
-
from airflow.
|
|
23
|
+
from airflow.providers.common.compat.sdk import BaseOperator
|
|
23
24
|
from airflow.providers.mysql.hooks.mysql import MySqlHook
|
|
24
25
|
from airflow.providers.presto.hooks.presto import PrestoHook
|
|
25
26
|
|
|
26
27
|
if TYPE_CHECKING:
|
|
27
|
-
from airflow.
|
|
28
|
+
from airflow.providers.common.compat.sdk import Context
|
|
28
29
|
|
|
29
30
|
|
|
30
31
|
class PrestoToMySqlOperator(BaseOperator):
|
|
@@ -17,14 +17,15 @@
|
|
|
17
17
|
from __future__ import annotations
|
|
18
18
|
|
|
19
19
|
import os
|
|
20
|
-
from
|
|
20
|
+
from collections.abc import Sequence
|
|
21
|
+
from typing import TYPE_CHECKING
|
|
21
22
|
|
|
22
|
-
from airflow.models import BaseOperator
|
|
23
23
|
from airflow.providers.amazon.aws.hooks.s3 import S3Hook
|
|
24
|
+
from airflow.providers.common.compat.sdk import BaseOperator
|
|
24
25
|
from airflow.providers.mysql.hooks.mysql import MySqlHook
|
|
25
26
|
|
|
26
27
|
if TYPE_CHECKING:
|
|
27
|
-
from airflow.
|
|
28
|
+
from airflow.providers.common.compat.sdk import Context
|
|
28
29
|
|
|
29
30
|
|
|
30
31
|
class S3ToMySqlOperator(BaseOperator):
|
|
@@ -17,14 +17,15 @@
|
|
|
17
17
|
# under the License.
|
|
18
18
|
from __future__ import annotations
|
|
19
19
|
|
|
20
|
-
from
|
|
20
|
+
from collections.abc import Sequence
|
|
21
|
+
from typing import TYPE_CHECKING
|
|
21
22
|
|
|
22
|
-
from airflow.
|
|
23
|
+
from airflow.providers.common.compat.sdk import BaseOperator
|
|
23
24
|
from airflow.providers.mysql.hooks.mysql import MySqlHook
|
|
24
25
|
from airflow.providers.trino.hooks.trino import TrinoHook
|
|
25
26
|
|
|
26
27
|
if TYPE_CHECKING:
|
|
27
|
-
from airflow.
|
|
28
|
+
from airflow.providers.common.compat.sdk import Context
|
|
28
29
|
|
|
29
30
|
|
|
30
31
|
class TrinoToMySqlOperator(BaseOperator):
|
|
@@ -18,18 +18,27 @@
|
|
|
18
18
|
from __future__ import annotations
|
|
19
19
|
|
|
20
20
|
import csv
|
|
21
|
+
from collections.abc import Sequence
|
|
21
22
|
from contextlib import closing
|
|
22
23
|
from tempfile import NamedTemporaryFile
|
|
23
|
-
from typing import TYPE_CHECKING
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
24
|
+
from typing import TYPE_CHECKING
|
|
25
|
+
|
|
26
|
+
try:
|
|
27
|
+
import MySQLdb
|
|
28
|
+
except ImportError:
|
|
29
|
+
raise RuntimeError(
|
|
30
|
+
"You do not have `mysqlclient` package installed. "
|
|
31
|
+
"Please install it with `pip install mysqlclient` and make sure you have system "
|
|
32
|
+
"mysql libraries installed, as well as well as `pkg-config` system package "
|
|
33
|
+
"installed in case you see compilation error during installation."
|
|
34
|
+
)
|
|
35
|
+
|
|
36
|
+
from airflow.providers.common.compat.sdk import BaseOperator
|
|
28
37
|
from airflow.providers.mysql.hooks.mysql import MySqlHook
|
|
29
38
|
from airflow.providers.vertica.hooks.vertica import VerticaHook
|
|
30
39
|
|
|
31
40
|
if TYPE_CHECKING:
|
|
32
|
-
from airflow.
|
|
41
|
+
from airflow.providers.common.compat.sdk import Context
|
|
33
42
|
|
|
34
43
|
|
|
35
44
|
class VerticaToMySqlOperator(BaseOperator):
|
|
@@ -133,21 +142,20 @@ class VerticaToMySqlOperator(BaseOperator):
|
|
|
133
142
|
count += 1
|
|
134
143
|
|
|
135
144
|
tmpfile.flush()
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
raise
|
|
145
|
+
self._run_preoperator(mysql)
|
|
146
|
+
try:
|
|
147
|
+
self.log.info("Bulk inserting rows into MySQL...")
|
|
148
|
+
with closing(mysql.get_conn()) as conn2, closing(conn2.cursor()) as cursor2:
|
|
149
|
+
cursor2.execute(
|
|
150
|
+
f"LOAD DATA LOCAL INFILE '{tmpfile.name}' "
|
|
151
|
+
f"INTO TABLE {self.mysql_table} "
|
|
152
|
+
f"LINES TERMINATED BY '\r\n' ({', '.join(selected_columns)})"
|
|
153
|
+
)
|
|
154
|
+
conn2.commit()
|
|
155
|
+
self.log.info("Inserted rows into MySQL %s", count)
|
|
156
|
+
except (MySQLdb.Error, MySQLdb.Warning):
|
|
157
|
+
self.log.info("Inserted rows into MySQL 0")
|
|
158
|
+
raise
|
|
151
159
|
|
|
152
160
|
def _run_preoperator(self, mysql):
|
|
153
161
|
if self.mysql_preoperator:
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
#
|
|
2
1
|
# Licensed to the Apache Software Foundation (ASF) under one
|
|
3
2
|
# or more contributor license agreements. See the NOTICE file
|
|
4
3
|
# distributed with this work for additional information
|
|
@@ -15,3 +14,21 @@
|
|
|
15
14
|
# KIND, either express or implied. See the License for the
|
|
16
15
|
# specific language governing permissions and limitations
|
|
17
16
|
# under the License.
|
|
17
|
+
|
|
18
|
+
from __future__ import annotations
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
def get_base_airflow_version_tuple() -> tuple[int, int, int]:
|
|
22
|
+
from packaging.version import Version
|
|
23
|
+
|
|
24
|
+
from airflow import __version__
|
|
25
|
+
|
|
26
|
+
airflow_version = Version(__version__)
|
|
27
|
+
return airflow_version.major, airflow_version.minor, airflow_version.micro
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
AIRFLOW_V_3_0_PLUS = get_base_airflow_version_tuple() >= (3, 0, 0)
|
|
31
|
+
|
|
32
|
+
__all__ = [
|
|
33
|
+
"AIRFLOW_V_3_0_PLUS",
|
|
34
|
+
]
|
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: apache-airflow-providers-mysql
|
|
3
|
-
Version:
|
|
3
|
+
Version: 6.4.1rc1
|
|
4
4
|
Summary: Provider package apache-airflow-providers-mysql for Apache Airflow
|
|
5
5
|
Keywords: airflow-provider,mysql,airflow,integration
|
|
6
6
|
Author-email: Apache Software Foundation <dev@airflow.apache.org>
|
|
7
7
|
Maintainer-email: Apache Software Foundation <dev@airflow.apache.org>
|
|
8
|
-
Requires-Python:
|
|
8
|
+
Requires-Python: >=3.10
|
|
9
9
|
Description-Content-Type: text/x-rst
|
|
10
|
+
License-Expression: Apache-2.0
|
|
10
11
|
Classifier: Development Status :: 5 - Production/Stable
|
|
11
12
|
Classifier: Environment :: Console
|
|
12
13
|
Classifier: Environment :: Web Environment
|
|
@@ -14,32 +15,32 @@ Classifier: Intended Audience :: Developers
|
|
|
14
15
|
Classifier: Intended Audience :: System Administrators
|
|
15
16
|
Classifier: Framework :: Apache Airflow
|
|
16
17
|
Classifier: Framework :: Apache Airflow :: Provider
|
|
17
|
-
Classifier: License :: OSI Approved :: Apache Software License
|
|
18
|
-
Classifier: Programming Language :: Python :: 3.8
|
|
19
|
-
Classifier: Programming Language :: Python :: 3.9
|
|
20
18
|
Classifier: Programming Language :: Python :: 3.10
|
|
21
19
|
Classifier: Programming Language :: Python :: 3.11
|
|
22
20
|
Classifier: Programming Language :: Python :: 3.12
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
23
22
|
Classifier: Topic :: System :: Monitoring
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
Requires-Dist:
|
|
27
|
-
Requires-Dist:
|
|
23
|
+
License-File: LICENSE
|
|
24
|
+
License-File: NOTICE
|
|
25
|
+
Requires-Dist: apache-airflow>=2.11.0rc1
|
|
26
|
+
Requires-Dist: apache-airflow-providers-common-compat>=1.12.0rc1
|
|
27
|
+
Requires-Dist: apache-airflow-providers-common-sql>=1.20.0rc1
|
|
28
|
+
Requires-Dist: mysqlclient>=2.2.5; sys_platform != "darwin"
|
|
29
|
+
Requires-Dist: mysql-connector-python>=9.1.0
|
|
30
|
+
Requires-Dist: aiomysql>=0.2.0
|
|
28
31
|
Requires-Dist: apache-airflow-providers-amazon ; extra == "amazon"
|
|
29
|
-
Requires-Dist: apache-airflow-providers-common-sql ; extra == "common.sql"
|
|
30
32
|
Requires-Dist: apache-airflow-providers-openlineage ; extra == "openlineage"
|
|
31
33
|
Requires-Dist: apache-airflow-providers-presto ; extra == "presto"
|
|
32
34
|
Requires-Dist: apache-airflow-providers-trino ; extra == "trino"
|
|
33
35
|
Requires-Dist: apache-airflow-providers-vertica ; extra == "vertica"
|
|
34
36
|
Project-URL: Bug Tracker, https://github.com/apache/airflow/issues
|
|
35
|
-
Project-URL: Changelog, https://airflow.apache.org/docs/apache-airflow-providers-mysql/
|
|
36
|
-
Project-URL: Documentation, https://airflow.apache.org/docs/apache-airflow-providers-mysql/
|
|
37
|
+
Project-URL: Changelog, https://airflow.staged.apache.org/docs/apache-airflow-providers-mysql/6.4.1/changelog.html
|
|
38
|
+
Project-URL: Documentation, https://airflow.staged.apache.org/docs/apache-airflow-providers-mysql/6.4.1
|
|
39
|
+
Project-URL: Mastodon, https://fosstodon.org/@airflow
|
|
37
40
|
Project-URL: Slack Chat, https://s.apache.org/airflow-slack
|
|
38
41
|
Project-URL: Source Code, https://github.com/apache/airflow
|
|
39
|
-
Project-URL: Twitter, https://twitter.com/ApacheAirflow
|
|
40
42
|
Project-URL: YouTube, https://www.youtube.com/channel/UCSXwxpWZQ7XZ1WL3wqevChA/
|
|
41
43
|
Provides-Extra: amazon
|
|
42
|
-
Provides-Extra: common.sql
|
|
43
44
|
Provides-Extra: mysql-connector-python
|
|
44
45
|
Provides-Extra: openlineage
|
|
45
46
|
Provides-Extra: presto
|
|
@@ -64,33 +65,14 @@ Provides-Extra: vertica
|
|
|
64
65
|
specific language governing permissions and limitations
|
|
65
66
|
under the License.
|
|
66
67
|
|
|
67
|
-
|
|
68
|
-
or more contributor license agreements. See the NOTICE file
|
|
69
|
-
distributed with this work for additional information
|
|
70
|
-
regarding copyright ownership. The ASF licenses this file
|
|
71
|
-
to you under the Apache License, Version 2.0 (the
|
|
72
|
-
"License"); you may not use this file except in compliance
|
|
73
|
-
with the License. You may obtain a copy of the License at
|
|
74
|
-
|
|
75
|
-
.. http://www.apache.org/licenses/LICENSE-2.0
|
|
76
|
-
|
|
77
|
-
.. Unless required by applicable law or agreed to in writing,
|
|
78
|
-
software distributed under the License is distributed on an
|
|
79
|
-
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
80
|
-
KIND, either express or implied. See the License for the
|
|
81
|
-
specific language governing permissions and limitations
|
|
82
|
-
under the License.
|
|
83
|
-
|
|
84
|
-
.. NOTE! THIS FILE IS AUTOMATICALLY GENERATED AND WILL BE
|
|
85
|
-
OVERWRITTEN WHEN PREPARING PACKAGES.
|
|
86
|
-
|
|
87
|
-
.. IF YOU WANT TO MODIFY TEMPLATE FOR THIS FILE, YOU SHOULD MODIFY THE TEMPLATE
|
|
88
|
-
`PROVIDER_README_TEMPLATE.rst.jinja2` IN the `dev/breeze/src/airflow_breeze/templates` DIRECTORY
|
|
68
|
+
.. NOTE! THIS FILE IS AUTOMATICALLY GENERATED AND WILL BE OVERWRITTEN!
|
|
89
69
|
|
|
70
|
+
.. IF YOU WANT TO MODIFY TEMPLATE FOR THIS FILE, YOU SHOULD MODIFY THE TEMPLATE
|
|
71
|
+
``PROVIDER_README_TEMPLATE.rst.jinja2`` IN the ``dev/breeze/src/airflow_breeze/templates`` DIRECTORY
|
|
90
72
|
|
|
91
73
|
Package ``apache-airflow-providers-mysql``
|
|
92
74
|
|
|
93
|
-
Release: ``
|
|
75
|
+
Release: ``6.4.1``
|
|
94
76
|
|
|
95
77
|
|
|
96
78
|
`MySQL <https://www.mysql.com/>`__
|
|
@@ -103,34 +85,36 @@ This is a provider package for ``mysql`` provider. All classes for this provider
|
|
|
103
85
|
are in ``airflow.providers.mysql`` python package.
|
|
104
86
|
|
|
105
87
|
You can find package information and changelog for the provider
|
|
106
|
-
in the `documentation <https://airflow.apache.org/docs/apache-airflow-providers-mysql/
|
|
88
|
+
in the `documentation <https://airflow.apache.org/docs/apache-airflow-providers-mysql/6.4.1/>`_.
|
|
107
89
|
|
|
108
90
|
Installation
|
|
109
91
|
------------
|
|
110
92
|
|
|
111
|
-
You can install this package on top of an existing Airflow
|
|
93
|
+
You can install this package on top of an existing Airflow installation (see ``Requirements`` below
|
|
112
94
|
for the minimum Airflow version supported) via
|
|
113
95
|
``pip install apache-airflow-providers-mysql``
|
|
114
96
|
|
|
115
|
-
The package supports the following python versions: 3.
|
|
97
|
+
The package supports the following python versions: 3.10,3.11,3.12,3.13
|
|
116
98
|
|
|
117
99
|
Requirements
|
|
118
100
|
------------
|
|
119
101
|
|
|
120
|
-
|
|
121
|
-
PIP package
|
|
122
|
-
|
|
123
|
-
``apache-airflow``
|
|
124
|
-
``apache-airflow-providers-common-
|
|
125
|
-
``
|
|
126
|
-
``
|
|
127
|
-
|
|
102
|
+
========================================== =====================================
|
|
103
|
+
PIP package Version required
|
|
104
|
+
========================================== =====================================
|
|
105
|
+
``apache-airflow`` ``>=2.11.0``
|
|
106
|
+
``apache-airflow-providers-common-compat`` ``>=1.8.0``
|
|
107
|
+
``apache-airflow-providers-common-sql`` ``>=1.20.0``
|
|
108
|
+
``mysqlclient`` ``>=2.2.5; sys_platform != "darwin"``
|
|
109
|
+
``mysql-connector-python`` ``>=9.1.0``
|
|
110
|
+
``aiomysql`` ``>=0.2.0``
|
|
111
|
+
========================================== =====================================
|
|
128
112
|
|
|
129
113
|
Cross provider package dependencies
|
|
130
114
|
-----------------------------------
|
|
131
115
|
|
|
132
116
|
Those are dependencies that might be needed in order to use all the features of the package.
|
|
133
|
-
You need to install the specified
|
|
117
|
+
You need to install the specified providers in order to use them.
|
|
134
118
|
|
|
135
119
|
You can install such cross-provider dependencies when installing from PyPI. For example:
|
|
136
120
|
|
|
@@ -139,16 +123,32 @@ You can install such cross-provider dependencies when installing from PyPI. For
|
|
|
139
123
|
pip install apache-airflow-providers-mysql[amazon]
|
|
140
124
|
|
|
141
125
|
|
|
142
|
-
|
|
143
|
-
Dependent package
|
|
144
|
-
|
|
145
|
-
`apache-airflow-providers-amazon <https://airflow.apache.org/docs/apache-airflow-providers-amazon>`_
|
|
146
|
-
`apache-airflow-providers-common-
|
|
147
|
-
`apache-airflow-providers-
|
|
148
|
-
`apache-airflow-providers-
|
|
149
|
-
`apache-airflow-providers-
|
|
150
|
-
`apache-airflow-providers-
|
|
151
|
-
|
|
126
|
+
================================================================================================================== =================
|
|
127
|
+
Dependent package Extra
|
|
128
|
+
================================================================================================================== =================
|
|
129
|
+
`apache-airflow-providers-amazon <https://airflow.apache.org/docs/apache-airflow-providers-amazon>`_ ``amazon``
|
|
130
|
+
`apache-airflow-providers-common-compat <https://airflow.apache.org/docs/apache-airflow-providers-common-compat>`_ ``common.compat``
|
|
131
|
+
`apache-airflow-providers-common-sql <https://airflow.apache.org/docs/apache-airflow-providers-common-sql>`_ ``common.sql``
|
|
132
|
+
`apache-airflow-providers-openlineage <https://airflow.apache.org/docs/apache-airflow-providers-openlineage>`_ ``openlineage``
|
|
133
|
+
`apache-airflow-providers-presto <https://airflow.apache.org/docs/apache-airflow-providers-presto>`_ ``presto``
|
|
134
|
+
`apache-airflow-providers-trino <https://airflow.apache.org/docs/apache-airflow-providers-trino>`_ ``trino``
|
|
135
|
+
`apache-airflow-providers-vertica <https://airflow.apache.org/docs/apache-airflow-providers-vertica>`_ ``vertica``
|
|
136
|
+
================================================================================================================== =================
|
|
137
|
+
|
|
138
|
+
Optional dependencies
|
|
139
|
+
----------------------
|
|
140
|
+
|
|
141
|
+
========================== ========================================
|
|
142
|
+
Extra Dependencies
|
|
143
|
+
========================== ========================================
|
|
144
|
+
``mysql-connector-python``
|
|
145
|
+
``amazon`` ``apache-airflow-providers-amazon``
|
|
146
|
+
``openlineage`` ``apache-airflow-providers-openlineage``
|
|
147
|
+
``presto`` ``apache-airflow-providers-presto``
|
|
148
|
+
``trino`` ``apache-airflow-providers-trino``
|
|
149
|
+
``vertica`` ``apache-airflow-providers-vertica``
|
|
150
|
+
========================== ========================================
|
|
152
151
|
|
|
153
152
|
The changelog for the provider package can be found in the
|
|
154
|
-
`changelog <https://airflow.apache.org/docs/apache-airflow-providers-mysql/
|
|
153
|
+
`changelog <https://airflow.apache.org/docs/apache-airflow-providers-mysql/6.4.1/changelog.html>`_.
|
|
154
|
+
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
airflow/providers/mysql/__init__.py,sha256=zHx583tV_vZv5sTBvHoE0TOcll9Ptl6xOvmlxtwNj3U,1494
|
|
2
|
+
airflow/providers/mysql/get_provider_info.py,sha256=LNQZ8O48srWzGjS8mzLeAsa-VFGFY6ypkHK1jjr6umc,3064
|
|
3
|
+
airflow/providers/mysql/version_compat.py,sha256=WjmnDM48kcYw3Je7Y3y2QW72dcq1nAhuuQb0EwxKJig,1197
|
|
4
|
+
airflow/providers/mysql/assets/__init__.py,sha256=9hdXHABrVpkbpjZgUft39kOFL2xSGeG4GEua0Hmelus,785
|
|
5
|
+
airflow/providers/mysql/assets/mysql.py,sha256=ORHZmCa1AZAWwpF7GKH-8faqOKSohJvKtqRgfDnQRRc,1385
|
|
6
|
+
airflow/providers/mysql/hooks/__init__.py,sha256=mlJxuZLkd5x-iq2SBwD3mvRQpt3YR7wjz_nceyF1IaI,787
|
|
7
|
+
airflow/providers/mysql/hooks/mysql.py,sha256=_933MwmGBLWrPxWeREtor8NaZVSA-44WOVF9QA3XSq4,16352
|
|
8
|
+
airflow/providers/mysql/transfers/__init__.py,sha256=9hdXHABrVpkbpjZgUft39kOFL2xSGeG4GEua0Hmelus,785
|
|
9
|
+
airflow/providers/mysql/transfers/presto_to_mysql.py,sha256=tD8IcBU9Bn-b9LC-g43QuV24Vi7ThfeLyB5HmJqp8zM,3331
|
|
10
|
+
airflow/providers/mysql/transfers/s3_to_mysql.py,sha256=E5Ldaj1rzhUeDKVTYo63VHAbVINcmzi1jZkUZRHTUXM,3938
|
|
11
|
+
airflow/providers/mysql/transfers/trino_to_mysql.py,sha256=gQapv53XpTeEOmro63nDZgN1H0qz9Ig2K5bOhaDDv6k,3313
|
|
12
|
+
airflow/providers/mysql/transfers/vertica_to_mysql.py,sha256=cVJqw3lncx4ZaicKjft9lR87sH-O54U-YlSgcppUDTU,6828
|
|
13
|
+
apache_airflow_providers_mysql-6.4.1rc1.dist-info/entry_points.txt,sha256=kIbWluJZ1LX9jo9pLkqbnu6DUgYpoGKXzmSvjT5czKM,101
|
|
14
|
+
apache_airflow_providers_mysql-6.4.1rc1.dist-info/licenses/LICENSE,sha256=gXPVwptPlW1TJ4HSuG5OMPg-a3h43OGMkZRR1rpwfJA,10850
|
|
15
|
+
apache_airflow_providers_mysql-6.4.1rc1.dist-info/licenses/NOTICE,sha256=_cWHznIoUSbLCY_KfmKqetlKlsoH0c2VBjmZjElAzuc,168
|
|
16
|
+
apache_airflow_providers_mysql-6.4.1rc1.dist-info/WHEEL,sha256=G2gURzTEtmeR8nrdXUJfNiB3VYVxigPQ-bEQujpNiNs,82
|
|
17
|
+
apache_airflow_providers_mysql-6.4.1rc1.dist-info/METADATA,sha256=xQ9EflUugsk2_BPVrKteHIkDdN6OlE9ebDi5LONLHAM,7526
|
|
18
|
+
apache_airflow_providers_mysql-6.4.1rc1.dist-info/RECORD,,
|
{airflow/providers/mysql → apache_airflow_providers_mysql-6.4.1rc1.dist-info/licenses}/LICENSE
RENAMED
|
@@ -199,55 +199,3 @@ distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
199
199
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
200
|
See the License for the specific language governing permissions and
|
|
201
201
|
limitations under the License.
|
|
202
|
-
|
|
203
|
-
============================================================================
|
|
204
|
-
APACHE AIRFLOW SUBCOMPONENTS:
|
|
205
|
-
|
|
206
|
-
The Apache Airflow project contains subcomponents with separate copyright
|
|
207
|
-
notices and license terms. Your use of the source code for the these
|
|
208
|
-
subcomponents is subject to the terms and conditions of the following
|
|
209
|
-
licenses.
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
========================================================================
|
|
213
|
-
Third party Apache 2.0 licenses
|
|
214
|
-
========================================================================
|
|
215
|
-
|
|
216
|
-
The following components are provided under the Apache 2.0 License.
|
|
217
|
-
See project link for details. The text of each license is also included
|
|
218
|
-
at 3rd-party-licenses/LICENSE-[project].txt.
|
|
219
|
-
|
|
220
|
-
(ALv2 License) hue v4.3.0 (https://github.com/cloudera/hue/)
|
|
221
|
-
(ALv2 License) jqclock v2.3.0 (https://github.com/JohnRDOrazio/jQuery-Clock-Plugin)
|
|
222
|
-
(ALv2 License) bootstrap3-typeahead v4.0.2 (https://github.com/bassjobsen/Bootstrap-3-Typeahead)
|
|
223
|
-
(ALv2 License) connexion v2.7.0 (https://github.com/zalando/connexion)
|
|
224
|
-
|
|
225
|
-
========================================================================
|
|
226
|
-
MIT licenses
|
|
227
|
-
========================================================================
|
|
228
|
-
|
|
229
|
-
The following components are provided under the MIT License. See project link for details.
|
|
230
|
-
The text of each license is also included at 3rd-party-licenses/LICENSE-[project].txt.
|
|
231
|
-
|
|
232
|
-
(MIT License) jquery v3.5.1 (https://jquery.org/license/)
|
|
233
|
-
(MIT License) dagre-d3 v0.6.4 (https://github.com/cpettitt/dagre-d3)
|
|
234
|
-
(MIT License) bootstrap v3.4.1 (https://github.com/twbs/bootstrap/)
|
|
235
|
-
(MIT License) d3-tip v0.9.1 (https://github.com/Caged/d3-tip)
|
|
236
|
-
(MIT License) dataTables v1.10.25 (https://datatables.net)
|
|
237
|
-
(MIT License) normalize.css v3.0.2 (http://necolas.github.io/normalize.css/)
|
|
238
|
-
(MIT License) ElasticMock v1.3.2 (https://github.com/vrcmarcos/elasticmock)
|
|
239
|
-
(MIT License) MomentJS v2.24.0 (http://momentjs.com/)
|
|
240
|
-
(MIT License) eonasdan-bootstrap-datetimepicker v4.17.49 (https://github.com/eonasdan/bootstrap-datetimepicker/)
|
|
241
|
-
|
|
242
|
-
========================================================================
|
|
243
|
-
BSD 3-Clause licenses
|
|
244
|
-
========================================================================
|
|
245
|
-
The following components are provided under the BSD 3-Clause license. See project links for details.
|
|
246
|
-
The text of each license is also included at 3rd-party-licenses/LICENSE-[project].txt.
|
|
247
|
-
|
|
248
|
-
(BSD 3 License) d3 v5.16.0 (https://d3js.org)
|
|
249
|
-
(BSD 3 License) d3-shape v2.1.0 (https://github.com/d3/d3-shape)
|
|
250
|
-
(BSD 3 License) cgroupspy 0.2.1 (https://github.com/cloudsigma/cgroupspy)
|
|
251
|
-
|
|
252
|
-
========================================================================
|
|
253
|
-
See 3rd-party-licenses/LICENSES-ui.txt for packages used in `/airflow/www`
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
#
|
|
2
|
-
# Licensed to the Apache Software Foundation (ASF) under one
|
|
3
|
-
# or more contributor license agreements. See the NOTICE file
|
|
4
|
-
# distributed with this work for additional information
|
|
5
|
-
# regarding copyright ownership. The ASF licenses this file
|
|
6
|
-
# to you under the Apache License, Version 2.0 (the
|
|
7
|
-
# "License"); you may not use this file except in compliance
|
|
8
|
-
# with the License. You may obtain a copy of the License at
|
|
9
|
-
#
|
|
10
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
-
#
|
|
12
|
-
# Unless required by applicable law or agreed to in writing,
|
|
13
|
-
# software distributed under the License is distributed on an
|
|
14
|
-
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
15
|
-
# KIND, either express or implied. See the License for the
|
|
16
|
-
# specific language governing permissions and limitations
|
|
17
|
-
# under the License.
|
|
18
|
-
from __future__ import annotations
|
|
19
|
-
|
|
20
|
-
from typing import Sequence
|
|
21
|
-
|
|
22
|
-
from deprecated import deprecated
|
|
23
|
-
|
|
24
|
-
from airflow.exceptions import AirflowProviderDeprecationWarning
|
|
25
|
-
from airflow.providers.common.sql.operators.sql import SQLExecuteQueryOperator
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
@deprecated(
|
|
29
|
-
reason=(
|
|
30
|
-
"Please use `airflow.providers.common.sql.operators.sql.SQLExecuteQueryOperator`."
|
|
31
|
-
"Also, you can provide `hook_params={'schema': <database>}`."
|
|
32
|
-
),
|
|
33
|
-
category=AirflowProviderDeprecationWarning,
|
|
34
|
-
)
|
|
35
|
-
class MySqlOperator(SQLExecuteQueryOperator):
|
|
36
|
-
"""
|
|
37
|
-
Executes sql code in a specific MySQL database.
|
|
38
|
-
|
|
39
|
-
This class is deprecated.
|
|
40
|
-
|
|
41
|
-
Please use :class:`airflow.providers.common.sql.operators.sql.SQLExecuteQueryOperator`.
|
|
42
|
-
|
|
43
|
-
.. seealso::
|
|
44
|
-
For more information on how to use this operator, take a look at the guide:
|
|
45
|
-
:ref:`howto/operator:mysql`
|
|
46
|
-
|
|
47
|
-
:param sql: the sql code to be executed. Can receive a str representing a
|
|
48
|
-
sql statement, a list of str (sql statements), or reference to a template file.
|
|
49
|
-
Template reference are recognized by str ending in '.sql'
|
|
50
|
-
(templated)
|
|
51
|
-
:param mysql_conn_id: Reference to :ref:`mysql connection id <howto/connection:mysql>`.
|
|
52
|
-
:param parameters: (optional) the parameters to render the SQL query with.
|
|
53
|
-
Template reference are recognized by str ending in '.json'
|
|
54
|
-
(templated)
|
|
55
|
-
:param autocommit: if True, each command is automatically committed.
|
|
56
|
-
(default value: False)
|
|
57
|
-
:param database: name of database which overwrite defined one in connection
|
|
58
|
-
"""
|
|
59
|
-
|
|
60
|
-
template_fields: Sequence[str] = ("sql", "parameters")
|
|
61
|
-
template_fields_renderers = {
|
|
62
|
-
"sql": "mysql",
|
|
63
|
-
"parameters": "json",
|
|
64
|
-
}
|
|
65
|
-
template_ext: Sequence[str] = (".sql", ".json")
|
|
66
|
-
ui_color = "#ededed"
|
|
67
|
-
|
|
68
|
-
def __init__(
|
|
69
|
-
self, *, mysql_conn_id: str = "mysql_default", database: str | None = None, **kwargs
|
|
70
|
-
) -> None:
|
|
71
|
-
if database is not None:
|
|
72
|
-
hook_params = kwargs.pop("hook_params", {})
|
|
73
|
-
kwargs["hook_params"] = {"schema": database, **hook_params}
|
|
74
|
-
|
|
75
|
-
super().__init__(conn_id=mysql_conn_id, **kwargs)
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
airflow/providers/mysql/LICENSE,sha256=FFb4jd2AXnOOf7XLP04pQW6jbdhG49TxlGY6fFpCV1Y,13609
|
|
2
|
-
airflow/providers/mysql/__init__.py,sha256=EO-GwQtXjRj-R0qfiyH2PkMTu91amP5-UO2LKIFVWPM,1492
|
|
3
|
-
airflow/providers/mysql/get_provider_info.py,sha256=bytFgTQ7Ayh7hV2FoLy7JwDH2CdXWzNL3kSrxqDJsTk,4289
|
|
4
|
-
airflow/providers/mysql/datasets/__init__.py,sha256=9hdXHABrVpkbpjZgUft39kOFL2xSGeG4GEua0Hmelus,785
|
|
5
|
-
airflow/providers/mysql/datasets/mysql.py,sha256=ORHZmCa1AZAWwpF7GKH-8faqOKSohJvKtqRgfDnQRRc,1385
|
|
6
|
-
airflow/providers/mysql/hooks/__init__.py,sha256=mlJxuZLkd5x-iq2SBwD3mvRQpt3YR7wjz_nceyF1IaI,787
|
|
7
|
-
airflow/providers/mysql/hooks/mysql.py,sha256=xrv813C5TAF4Suq2EGDMVT8Is7PUfeS-7FPimEQtXto,13220
|
|
8
|
-
airflow/providers/mysql/operators/__init__.py,sha256=mlJxuZLkd5x-iq2SBwD3mvRQpt3YR7wjz_nceyF1IaI,787
|
|
9
|
-
airflow/providers/mysql/operators/mysql.py,sha256=jEtskURwKliyx5IGoFx8cJmiALqkeJzU_rigDcLrapo,2926
|
|
10
|
-
airflow/providers/mysql/transfers/__init__.py,sha256=9hdXHABrVpkbpjZgUft39kOFL2xSGeG4GEua0Hmelus,785
|
|
11
|
-
airflow/providers/mysql/transfers/presto_to_mysql.py,sha256=gGtZIGXLpY2jP8o3xwZ5u8khqcQK3cVSa9P-aev7Qiw,3269
|
|
12
|
-
airflow/providers/mysql/transfers/s3_to_mysql.py,sha256=E5I7QHWqzrG3Fi9AGklwZWRCVxVDOD1tOB2xHEOZUJw,3876
|
|
13
|
-
airflow/providers/mysql/transfers/trino_to_mysql.py,sha256=wiiuilxSHchJD0W2K838UHH5iUs-R5HNc0zyRDOZDRs,3251
|
|
14
|
-
airflow/providers/mysql/transfers/vertica_to_mysql.py,sha256=NiIFMv0zy4M9Ynrs4InG9nqp6lyvmgDlz7_iDJWxQEI,6308
|
|
15
|
-
apache_airflow_providers_mysql-5.6.2rc1.dist-info/entry_points.txt,sha256=kIbWluJZ1LX9jo9pLkqbnu6DUgYpoGKXzmSvjT5czKM,101
|
|
16
|
-
apache_airflow_providers_mysql-5.6.2rc1.dist-info/WHEEL,sha256=EZbGkh7Ie4PoZfRQ8I0ZuP9VklN_TvcZ6DSE5Uar4z4,81
|
|
17
|
-
apache_airflow_providers_mysql-5.6.2rc1.dist-info/METADATA,sha256=FlMXkMQ4FQk8gHW9M8JfV77A0eQcKL025ERtJz0g_zk,7339
|
|
18
|
-
apache_airflow_providers_mysql-5.6.2rc1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|