dbhose-airflow 0.0.2.0__py3-none-any.whl → 0.0.2.1__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.
- dbhose_airflow/__init__.py +28 -4
- dbhose_airflow/chunk_query.py +14 -0
- dbhose_airflow/move_method.py +1 -0
- {dbhose_airflow-0.0.2.0.dist-info → dbhose_airflow-0.0.2.1.dist-info}/METADATA +3 -3
- dbhose_airflow-0.0.2.1.dist-info/RECORD +12 -0
- {dbhose_airflow-0.0.2.0.dist-info → dbhose_airflow-0.0.2.1.dist-info}/licenses/CHANGELOG.md +10 -0
- dbhose_airflow-0.0.2.0.dist-info/RECORD +0 -11
- {dbhose_airflow-0.0.2.0.dist-info → dbhose_airflow-0.0.2.1.dist-info}/WHEEL +0 -0
- {dbhose_airflow-0.0.2.0.dist-info → dbhose_airflow-0.0.2.1.dist-info}/licenses/README.md +0 -0
- {dbhose_airflow-0.0.2.0.dist-info → dbhose_airflow-0.0.2.1.dist-info}/top_level.txt +0 -0
dbhose_airflow/__init__.py
CHANGED
|
@@ -14,6 +14,7 @@ from pandas import DataFrame as PDFrame
|
|
|
14
14
|
from polars import DataFrame as PLFrame
|
|
15
15
|
|
|
16
16
|
from .airflow_connect import dbhose_dumper
|
|
17
|
+
from .chunk_query import query_part
|
|
17
18
|
from .dq_check import DQCheck
|
|
18
19
|
from .move_method import MoveMethod
|
|
19
20
|
|
|
@@ -31,7 +32,7 @@ __all__ = (
|
|
|
31
32
|
"dbhose_dumper",
|
|
32
33
|
)
|
|
33
34
|
__author__ = "0xMihalich"
|
|
34
|
-
__version__ = "0.0.2.
|
|
35
|
+
__version__ = "0.0.2.1"
|
|
35
36
|
|
|
36
37
|
|
|
37
38
|
root_path = dirname(__file__)
|
|
@@ -104,7 +105,7 @@ class DBHose:
|
|
|
104
105
|
self.connection_dest = connection_dest
|
|
105
106
|
self.connection_src = connection_src
|
|
106
107
|
self.dq_skip_check = dq_skip_check
|
|
107
|
-
self.filter_by = filter_by
|
|
108
|
+
self.filter_by = ", ".join(filter_by)
|
|
108
109
|
self.drop_temp_table = drop_temp_table
|
|
109
110
|
self.move_method = move_method
|
|
110
111
|
self.custom_move = custom_move
|
|
@@ -333,12 +334,23 @@ class DBHose:
|
|
|
333
334
|
self.logger.error(wrap_frame(error_msg))
|
|
334
335
|
raise ValueError(error_msg)
|
|
335
336
|
|
|
336
|
-
|
|
337
|
+
for query in query_part(self.custom_move):
|
|
338
|
+
self.dumper_dest.cursor.execute(query)
|
|
337
339
|
|
|
338
340
|
if self.dumper_dest.__class__ is not NativeDumper:
|
|
339
341
|
self.dumper_dest.connect.commit()
|
|
340
342
|
|
|
341
343
|
elif self.move_method.have_sql:
|
|
344
|
+
|
|
345
|
+
if (
|
|
346
|
+
self.move_method is MoveMethod.delete
|
|
347
|
+
and self.dumper_dest.__class__ is NativeDumper
|
|
348
|
+
and len(self.filter_by.split(", ")) > 4
|
|
349
|
+
):
|
|
350
|
+
error_msg = "Too many columns in filter_by (> 4)"
|
|
351
|
+
self.logger.error(wrap_frame(error_msg))
|
|
352
|
+
raise ValueError(error_msg)
|
|
353
|
+
|
|
342
354
|
move_query = read_text(
|
|
343
355
|
mv_path.format(self.dumper_dest.dbname, self.move_method.name)
|
|
344
356
|
)
|
|
@@ -357,12 +369,24 @@ class DBHose:
|
|
|
357
369
|
self.logger.error(wrap_frame(error_msg))
|
|
358
370
|
raise ValueError(error_msg)
|
|
359
371
|
|
|
360
|
-
|
|
372
|
+
for query in query_part(move_query):
|
|
373
|
+
self.dumper_dest.cursor.execute(query)
|
|
361
374
|
|
|
362
375
|
if self.dumper_dest.__class__ is not NativeDumper:
|
|
363
376
|
self.dumper_dest.connect.commit()
|
|
364
377
|
|
|
365
378
|
else:
|
|
379
|
+
if self.move_method is MoveMethod.rewrite:
|
|
380
|
+
self.logger.info("Clear table operation start")
|
|
381
|
+
self.dumper_dest.cursor.execute(
|
|
382
|
+
f"truncate table {self.table_dest}"
|
|
383
|
+
)
|
|
384
|
+
|
|
385
|
+
if self.dumper_dest.__class__ is not NativeDumper:
|
|
386
|
+
self.dumper_dest.connect.commit()
|
|
387
|
+
|
|
388
|
+
self.logger.info("Clear table operation done")
|
|
389
|
+
|
|
366
390
|
self.dumper_dest.write_between(self.table_dest, self.table_temp)
|
|
367
391
|
|
|
368
392
|
self.logger.info(wrap_frame(f"Data moved into {self.table_dest}"))
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
from re import split
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
pattern = r";(?=(?:[^']*'[^']*')*[^']*$)"
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
def query_part(query: str) -> tuple[str]:
|
|
8
|
+
"""Chunk multiquery to parts."""
|
|
9
|
+
|
|
10
|
+
return (
|
|
11
|
+
part.strip(";").strip()
|
|
12
|
+
for part in split(pattern, query)
|
|
13
|
+
if part.strip(";").strip()
|
|
14
|
+
)
|
dbhose_airflow/move_method.py
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: dbhose_airflow
|
|
3
|
-
Version: 0.0.2.
|
|
3
|
+
Version: 0.0.2.1
|
|
4
4
|
Summary: airflow class for exchanging data between DBMSs in native binary formats.
|
|
5
5
|
Home-page: https://github.com/0xMihalich/dbhose_airflow
|
|
6
6
|
Author: 0xMihalich
|
|
@@ -9,8 +9,8 @@ Description-Content-Type: text/markdown
|
|
|
9
9
|
License-File: README.md
|
|
10
10
|
License-File: CHANGELOG.md
|
|
11
11
|
Requires-Dist: apache-airflow>=2.4.3
|
|
12
|
-
Requires-Dist: native-dumper==0.3.3.
|
|
13
|
-
Requires-Dist: pgpack-dumper==0.3.3.
|
|
12
|
+
Requires-Dist: native-dumper==0.3.3.1
|
|
13
|
+
Requires-Dist: pgpack-dumper==0.3.3.1
|
|
14
14
|
Dynamic: author
|
|
15
15
|
Dynamic: author-email
|
|
16
16
|
Dynamic: description
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
dbhose_airflow/__init__.py,sha256=4ezXu1GfNIk5Lzq2LR6EMe-vCeujt8W8kU8HJt2TeB8,15298
|
|
2
|
+
dbhose_airflow/airflow_connect.py,sha256=unsRItnK4Q_ieMiGKEsCw8Q_8wkaXdVOfaSWLNRyujM,906
|
|
3
|
+
dbhose_airflow/chunk_query.py,sha256=qtR6FM0SAEHzm08o6AzMZepyzJ3J8qd_itdFY0YJQRg,275
|
|
4
|
+
dbhose_airflow/dq_check.py,sha256=VoAw8qieA5LM1a7jaMPO3AQ7QXe_-ThZ8Gy868ozjHw,689
|
|
5
|
+
dbhose_airflow/dumper.py,sha256=9BEJ36yUJ9gH5PiVirLXymSKPOgABtp7Ee8U6MtEckY,1843
|
|
6
|
+
dbhose_airflow/move_method.py,sha256=EkrDy2VCbL78zfZZhwWH0gF4Ijno20FP1mRfjiABrkk,532
|
|
7
|
+
dbhose_airflow-0.0.2.1.dist-info/licenses/CHANGELOG.md,sha256=sQAbtKsJ8SwQCgbUoXHbb9P8Yl8-UocOhG0K8cMd70w,852
|
|
8
|
+
dbhose_airflow-0.0.2.1.dist-info/licenses/README.md,sha256=-TsSFVS-bdRMNM-xhtqiZUXyD6D_lb6Uiz8LKEPGlP0,8822
|
|
9
|
+
dbhose_airflow-0.0.2.1.dist-info/METADATA,sha256=erGKDeYmuZp3-Erz2e47c07AMg0FxFUwD6nAipugC3U,9434
|
|
10
|
+
dbhose_airflow-0.0.2.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
11
|
+
dbhose_airflow-0.0.2.1.dist-info/top_level.txt,sha256=VlTXT0CLGGcVhbG9QPw2_a8H5UV03QMjvZ-NrPy6_jM,15
|
|
12
|
+
dbhose_airflow-0.0.2.1.dist-info/RECORD,,
|
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# Version History
|
|
2
2
|
|
|
3
|
+
## 0.0.2.1
|
|
4
|
+
|
|
5
|
+
* Add MoveMethod.rewrite for full rewrite table with new data
|
|
6
|
+
* Add query_part function
|
|
7
|
+
* Change filter_by initialization list to string
|
|
8
|
+
* Fix Clickhouse MoveMethod.delete
|
|
9
|
+
* Improve execute custom query & MoveMethod operations
|
|
10
|
+
* Update depends native-dumper==0.3.3.1
|
|
11
|
+
* Update depends pgpack-dumper==0.3.3.1
|
|
12
|
+
|
|
3
13
|
## 0.0.2.0
|
|
4
14
|
|
|
5
15
|
* Update depends native-dumper==0.3.3.0
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
dbhose_airflow/__init__.py,sha256=yMh49tSwt9x66RNpZYJYBLw_fXMzwUzbycyzUyp3W1g,14352
|
|
2
|
-
dbhose_airflow/airflow_connect.py,sha256=unsRItnK4Q_ieMiGKEsCw8Q_8wkaXdVOfaSWLNRyujM,906
|
|
3
|
-
dbhose_airflow/dq_check.py,sha256=VoAw8qieA5LM1a7jaMPO3AQ7QXe_-ThZ8Gy868ozjHw,689
|
|
4
|
-
dbhose_airflow/dumper.py,sha256=9BEJ36yUJ9gH5PiVirLXymSKPOgABtp7Ee8U6MtEckY,1843
|
|
5
|
-
dbhose_airflow/move_method.py,sha256=c4g7wuiwDKudrKSWP4ov1atJGIFknHCgPnY9FMf9Ymc,477
|
|
6
|
-
dbhose_airflow-0.0.2.0.dist-info/licenses/CHANGELOG.md,sha256=7HHfS-x8gX3UXBOGEuPsgmlEOFWNRILjLlE3qrNaaqQ,532
|
|
7
|
-
dbhose_airflow-0.0.2.0.dist-info/licenses/README.md,sha256=-TsSFVS-bdRMNM-xhtqiZUXyD6D_lb6Uiz8LKEPGlP0,8822
|
|
8
|
-
dbhose_airflow-0.0.2.0.dist-info/METADATA,sha256=I0KTrMK0VYlrg9IMbjykKeo02GU-c1ZDxZKEjf4lLas,9434
|
|
9
|
-
dbhose_airflow-0.0.2.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
10
|
-
dbhose_airflow-0.0.2.0.dist-info/top_level.txt,sha256=VlTXT0CLGGcVhbG9QPw2_a8H5UV03QMjvZ-NrPy6_jM,15
|
|
11
|
-
dbhose_airflow-0.0.2.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|