dbhose-airflow 0.0.2.1__py3-none-any.whl → 0.0.2.3__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/LOGO +9 -0
- dbhose_airflow/__init__.py +1 -1
- dbhose_airflow/ddl/clickhouse.sql +81 -0
- dbhose_airflow/ddl/greenplum.sql +229 -0
- dbhose_airflow/ddl/postgres.sql +209 -0
- dbhose_airflow/dq/clickhouse/empty.sql +1 -0
- dbhose_airflow/dq/clickhouse/future.sql +34 -0
- dbhose_airflow/dq/clickhouse/infinity.sql +34 -0
- dbhose_airflow/dq/clickhouse/nan.sql +34 -0
- dbhose_airflow/dq/clickhouse/sum.sql +72 -0
- dbhose_airflow/dq/clickhouse/total.sql +1 -0
- dbhose_airflow/dq/clickhouse/uniq.sql +1 -0
- dbhose_airflow/dq/greenplum/empty.sql +1 -0
- dbhose_airflow/dq/greenplum/future.sql +55 -0
- dbhose_airflow/dq/greenplum/infinity.sql +60 -0
- dbhose_airflow/dq/greenplum/nan.sql +58 -0
- dbhose_airflow/dq/greenplum/sum.sql +63 -0
- dbhose_airflow/dq/greenplum/total.sql +1 -0
- dbhose_airflow/dq/greenplum/uniq.sql +2 -0
- dbhose_airflow/dq/postgres/empty.sql +1 -0
- dbhose_airflow/dq/postgres/future.sql +55 -0
- dbhose_airflow/dq/postgres/infinity.sql +60 -0
- dbhose_airflow/dq/postgres/nan.sql +58 -0
- dbhose_airflow/dq/postgres/sum.sql +63 -0
- dbhose_airflow/dq/postgres/total.sql +1 -0
- dbhose_airflow/dq/postgres/uniq.sql +2 -0
- dbhose_airflow/move/clickhouse/delete.sql +81 -0
- dbhose_airflow/move/clickhouse/replace.sql +24 -0
- dbhose_airflow/move/greenplum/delete.sql +10 -0
- dbhose_airflow/move/greenplum/replace.sql +60 -0
- dbhose_airflow/move/postgres/delete.sql +10 -0
- dbhose_airflow/move/postgres/replace.sql +60 -0
- {dbhose_airflow-0.0.2.1.dist-info → dbhose_airflow-0.0.2.3.dist-info}/METADATA +2 -2
- dbhose_airflow-0.0.2.3.dist-info/RECORD +43 -0
- {dbhose_airflow-0.0.2.1.dist-info → dbhose_airflow-0.0.2.3.dist-info}/licenses/CHANGELOG.md +9 -0
- dbhose_airflow-0.0.2.1.dist-info/RECORD +0 -12
- {dbhose_airflow-0.0.2.1.dist-info → dbhose_airflow-0.0.2.3.dist-info}/WHEEL +0 -0
- {dbhose_airflow-0.0.2.1.dist-info → dbhose_airflow-0.0.2.3.dist-info}/licenses/README.md +0 -0
- {dbhose_airflow-0.0.2.1.dist-info → dbhose_airflow-0.0.2.3.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
with filter_columns as (
|
|
2
|
+
select array_length(string_to_array('{filter_by}', ', '), 1) as col_count
|
|
3
|
+
)
|
|
4
|
+
select
|
|
5
|
+
true as is_avaliable,
|
|
6
|
+
'DELETE FROM {table_dest} WHERE EXISTS(' || E'\nSELECT 1 FROM {table_temp}\nWHERE ' ||
|
|
7
|
+
(select string_agg('{table_dest}.' || trim(col) || ' = {table_temp}.' || trim(col), E'\nAND ')
|
|
8
|
+
from unnest(string_to_array('{filter_by}', ',')) as col) || E'\n);\n' ||
|
|
9
|
+
E'INSERT INTO {table_dest}\nSELECT * FROM {table_temp};' as move_query
|
|
10
|
+
from filter_columns
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
with
|
|
2
|
+
matching_partitions as (
|
|
3
|
+
select
|
|
4
|
+
table_partition
|
|
5
|
+
, partition_constraint
|
|
6
|
+
from (
|
|
7
|
+
select
|
|
8
|
+
child.relname as table_partition
|
|
9
|
+
, pg_get_expr(child.relpartbound, child.oid) as partition_constraint
|
|
10
|
+
from pg_inherits
|
|
11
|
+
join pg_class child
|
|
12
|
+
on pg_inherits.inhrelid = child.oid
|
|
13
|
+
where pg_inherits.inhparent = '{table_dest}'::regclass
|
|
14
|
+
) as dest_tbl
|
|
15
|
+
join (
|
|
16
|
+
select
|
|
17
|
+
pg_get_expr(child.relpartbound, child.oid) as partition_constraint
|
|
18
|
+
, child.oid as partition_oid
|
|
19
|
+
from pg_inherits
|
|
20
|
+
join pg_class child
|
|
21
|
+
on pg_inherits.inhrelid = child.oid
|
|
22
|
+
where pg_inherits.inhparent = '{table_temp}'::regclass
|
|
23
|
+
) as temp_tbl
|
|
24
|
+
using(partition_constraint)
|
|
25
|
+
where exists (
|
|
26
|
+
select 1
|
|
27
|
+
from pg_class
|
|
28
|
+
where oid = temp_tbl.partition_oid
|
|
29
|
+
and reltuples > 0
|
|
30
|
+
)
|
|
31
|
+
),
|
|
32
|
+
detach_commands as (
|
|
33
|
+
select string_agg(
|
|
34
|
+
'ALTER TABLE {table_dest} DETACH PARTITION ' ||
|
|
35
|
+
table_partition || ';'
|
|
36
|
+
, E'\n'
|
|
37
|
+
) as commands
|
|
38
|
+
from matching_partitions
|
|
39
|
+
),
|
|
40
|
+
attach_commands as (
|
|
41
|
+
select string_agg(
|
|
42
|
+
'ALTER TABLE {table_dest} ATTACH PARTITION {table_temp} ' ||
|
|
43
|
+
partition_constraint || ';'
|
|
44
|
+
, E'\n'
|
|
45
|
+
) as commands
|
|
46
|
+
from matching_partitions
|
|
47
|
+
),
|
|
48
|
+
drop_commands as (
|
|
49
|
+
select string_agg(
|
|
50
|
+
'DROP TABLE ' || table_partition || ';'
|
|
51
|
+
, E'\n'
|
|
52
|
+
) as commands
|
|
53
|
+
from matching_partitions
|
|
54
|
+
)
|
|
55
|
+
select
|
|
56
|
+
(select case when count(*) > 0 then true else false end
|
|
57
|
+
from matching_partitions) as is_avaliable
|
|
58
|
+
, (select commands from detach_commands) || E'\n' ||
|
|
59
|
+
(select commands from attach_commands) || E'\n' ||
|
|
60
|
+
(select commands from drop_commands) as move_query
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
with filter_columns as (
|
|
2
|
+
select array_length(string_to_array('{filter_by}', ', '), 1) as col_count
|
|
3
|
+
)
|
|
4
|
+
select
|
|
5
|
+
true as is_avaliable,
|
|
6
|
+
'DELETE FROM {table_dest} WHERE EXISTS(' || E'\nSELECT 1 FROM {table_temp}\nWHERE ' ||
|
|
7
|
+
(select string_agg('{table_dest}.' || trim(col) || ' = {table_temp}.' || trim(col), E'\nAND ')
|
|
8
|
+
from unnest(string_to_array('{filter_by}', ',')) as col) || E'\n);\n' ||
|
|
9
|
+
E'INSERT INTO {table_dest}\nSELECT * FROM {table_temp};' as move_query
|
|
10
|
+
from filter_columns
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
with
|
|
2
|
+
matching_partitions as (
|
|
3
|
+
select
|
|
4
|
+
table_partition
|
|
5
|
+
, partition_constraint
|
|
6
|
+
from (
|
|
7
|
+
select
|
|
8
|
+
child.relname as table_partition
|
|
9
|
+
, pg_get_expr(child.relpartbound, child.oid) as partition_constraint
|
|
10
|
+
from pg_inherits
|
|
11
|
+
join pg_class child
|
|
12
|
+
on pg_inherits.inhrelid = child.oid
|
|
13
|
+
where pg_inherits.inhparent = '{table_dest}'::regclass
|
|
14
|
+
) as dest_tbl
|
|
15
|
+
join (
|
|
16
|
+
select
|
|
17
|
+
pg_get_expr(child.relpartbound, child.oid) as partition_constraint
|
|
18
|
+
, child.oid as partition_oid
|
|
19
|
+
from pg_inherits
|
|
20
|
+
join pg_class child
|
|
21
|
+
on pg_inherits.inhrelid = child.oid
|
|
22
|
+
where pg_inherits.inhparent = '{table_temp}'::regclass
|
|
23
|
+
) as temp_tbl
|
|
24
|
+
using(partition_constraint)
|
|
25
|
+
where exists (
|
|
26
|
+
select 1
|
|
27
|
+
from pg_class
|
|
28
|
+
where oid = temp_tbl.partition_oid
|
|
29
|
+
and reltuples > 0
|
|
30
|
+
)
|
|
31
|
+
),
|
|
32
|
+
detach_commands as (
|
|
33
|
+
select string_agg(
|
|
34
|
+
'ALTER TABLE {table_dest} DETACH PARTITION ' ||
|
|
35
|
+
table_partition || ';'
|
|
36
|
+
, E'\n'
|
|
37
|
+
) as commands
|
|
38
|
+
from matching_partitions
|
|
39
|
+
),
|
|
40
|
+
attach_commands as (
|
|
41
|
+
select string_agg(
|
|
42
|
+
'ALTER TABLE {table_dest} ATTACH PARTITION {table_temp} ' ||
|
|
43
|
+
partition_constraint || ';'
|
|
44
|
+
, E'\n'
|
|
45
|
+
) as commands
|
|
46
|
+
from matching_partitions
|
|
47
|
+
),
|
|
48
|
+
drop_commands as (
|
|
49
|
+
select string_agg(
|
|
50
|
+
'DROP TABLE ' || table_partition || ';'
|
|
51
|
+
, E'\n'
|
|
52
|
+
) as commands
|
|
53
|
+
from matching_partitions
|
|
54
|
+
)
|
|
55
|
+
select
|
|
56
|
+
(select case when count(*) > 0 then true else false end
|
|
57
|
+
from matching_partitions) as is_avaliable
|
|
58
|
+
, (select commands from detach_commands) || E'\n' ||
|
|
59
|
+
(select commands from attach_commands) || E'\n' ||
|
|
60
|
+
(select commands from drop_commands) as move_query
|
|
@@ -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.3
|
|
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
|
|
@@ -10,7 +10,7 @@ License-File: README.md
|
|
|
10
10
|
License-File: CHANGELOG.md
|
|
11
11
|
Requires-Dist: apache-airflow>=2.4.3
|
|
12
12
|
Requires-Dist: native-dumper==0.3.3.1
|
|
13
|
-
Requires-Dist: pgpack-dumper==0.3.3.
|
|
13
|
+
Requires-Dist: pgpack-dumper==0.3.3.2
|
|
14
14
|
Dynamic: author
|
|
15
15
|
Dynamic: author-email
|
|
16
16
|
Dynamic: description
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
dbhose_airflow/LOGO,sha256=zfn071DUmSt3OzqIN-knPqoYDqUNbxO2ALfdDaEII6A,783
|
|
2
|
+
dbhose_airflow/__init__.py,sha256=J1AlJiPEnjQa5zo1DqUTKRgXH-jq2ZwonmxaoXwhX7Y,15298
|
|
3
|
+
dbhose_airflow/airflow_connect.py,sha256=unsRItnK4Q_ieMiGKEsCw8Q_8wkaXdVOfaSWLNRyujM,906
|
|
4
|
+
dbhose_airflow/chunk_query.py,sha256=qtR6FM0SAEHzm08o6AzMZepyzJ3J8qd_itdFY0YJQRg,275
|
|
5
|
+
dbhose_airflow/dq_check.py,sha256=VoAw8qieA5LM1a7jaMPO3AQ7QXe_-ThZ8Gy868ozjHw,689
|
|
6
|
+
dbhose_airflow/dumper.py,sha256=9BEJ36yUJ9gH5PiVirLXymSKPOgABtp7Ee8U6MtEckY,1843
|
|
7
|
+
dbhose_airflow/move_method.py,sha256=EkrDy2VCbL78zfZZhwWH0gF4Ijno20FP1mRfjiABrkk,532
|
|
8
|
+
dbhose_airflow/ddl/clickhouse.sql,sha256=HKIB2GhWgAGlipC4vS5EUI-YcmFnG34u5nm4bTyDkkU,2617
|
|
9
|
+
dbhose_airflow/ddl/greenplum.sql,sha256=F_tCfaTz8YJ4bt2XPWa3Xln4Pe7ar8SKj-eznc3gWqs,9322
|
|
10
|
+
dbhose_airflow/ddl/postgres.sql,sha256=qylCEgaY0UqcBtRwan5jH8CD3MCKVtaLqThodSgteR0,8256
|
|
11
|
+
dbhose_airflow/dq/clickhouse/empty.sql,sha256=noHKmdqwhOGWqU30qW1lQDShOPPtu80FXDVZ-Qjxzmo,96
|
|
12
|
+
dbhose_airflow/dq/clickhouse/future.sql,sha256=_pXiaR2TsEk0ZNU911rRJe0HCOy9oSHG21kxDtZ2AxU,846
|
|
13
|
+
dbhose_airflow/dq/clickhouse/infinity.sql,sha256=nrb1Pgaik7ty3egXIU49gf0N-9TCq-OvjlFCZZKHVn0,836
|
|
14
|
+
dbhose_airflow/dq/clickhouse/nan.sql,sha256=oe1lUWGXqBrEfVH2JauCgAqD_NVJVAl62i8fMkpkDgE,855
|
|
15
|
+
dbhose_airflow/dq/clickhouse/sum.sql,sha256=wwtLpuaszzs-bpkiB2zmAHEvlH6cWCD7HDQcHy7pZAo,1559
|
|
16
|
+
dbhose_airflow/dq/clickhouse/total.sql,sha256=lhw4PLEKN2Mn7E1FXIKg4l1IZ6cAHEZkPcLCbKbeP_4,37
|
|
17
|
+
dbhose_airflow/dq/clickhouse/uniq.sql,sha256=ZhyRgqBVEPxzfnpFAbAUB71Vt4OFoR22hyawF52NMDE,115
|
|
18
|
+
dbhose_airflow/dq/greenplum/empty.sql,sha256=bSlS58_VtWz8F3hJfbaXZArVV9QLrFCXUJmghWB52TQ,99
|
|
19
|
+
dbhose_airflow/dq/greenplum/future.sql,sha256=nN361zV_Cr8MxRk5n7_xN9-OGAgptY9BbuftacXV_uE,1590
|
|
20
|
+
dbhose_airflow/dq/greenplum/infinity.sql,sha256=pWx-vlloZ6fGPWPIx1MKgwia66p9P-I_HaOUOwavYIM,1699
|
|
21
|
+
dbhose_airflow/dq/greenplum/nan.sql,sha256=J96yT0LKlgCE0NfbDtpBIy4sIXw7DHBfy9Td2cs_JPo,1560
|
|
22
|
+
dbhose_airflow/dq/greenplum/sum.sql,sha256=1uq6V2hXn3HJhQrAM_id0FCZd-fbbfdXUNLTMJyDBso,1642
|
|
23
|
+
dbhose_airflow/dq/greenplum/total.sql,sha256=lhw4PLEKN2Mn7E1FXIKg4l1IZ6cAHEZkPcLCbKbeP_4,37
|
|
24
|
+
dbhose_airflow/dq/greenplum/uniq.sql,sha256=myYh7TTc-c-ixnXwMibopz4bMr9qnkvU-29nt89cq8o,227
|
|
25
|
+
dbhose_airflow/dq/postgres/empty.sql,sha256=bSlS58_VtWz8F3hJfbaXZArVV9QLrFCXUJmghWB52TQ,99
|
|
26
|
+
dbhose_airflow/dq/postgres/future.sql,sha256=nN361zV_Cr8MxRk5n7_xN9-OGAgptY9BbuftacXV_uE,1590
|
|
27
|
+
dbhose_airflow/dq/postgres/infinity.sql,sha256=pWx-vlloZ6fGPWPIx1MKgwia66p9P-I_HaOUOwavYIM,1699
|
|
28
|
+
dbhose_airflow/dq/postgres/nan.sql,sha256=J96yT0LKlgCE0NfbDtpBIy4sIXw7DHBfy9Td2cs_JPo,1560
|
|
29
|
+
dbhose_airflow/dq/postgres/sum.sql,sha256=1uq6V2hXn3HJhQrAM_id0FCZd-fbbfdXUNLTMJyDBso,1642
|
|
30
|
+
dbhose_airflow/dq/postgres/total.sql,sha256=lhw4PLEKN2Mn7E1FXIKg4l1IZ6cAHEZkPcLCbKbeP_4,37
|
|
31
|
+
dbhose_airflow/dq/postgres/uniq.sql,sha256=myYh7TTc-c-ixnXwMibopz4bMr9qnkvU-29nt89cq8o,227
|
|
32
|
+
dbhose_airflow/move/clickhouse/delete.sql,sha256=qyQ3YrDqBx4AhRMqEvcfIJAP4UauVEys_BshuMsCgUs,4316
|
|
33
|
+
dbhose_airflow/move/clickhouse/replace.sql,sha256=B44YbVK3wcCOPhAp8-_yX3yxnpTjpJF7xx_fCRRxIBE,666
|
|
34
|
+
dbhose_airflow/move/greenplum/delete.sql,sha256=OJJqu3CmbipMUl_Oyw48yzRSfzchzyu4YAcu9gAscFc,502
|
|
35
|
+
dbhose_airflow/move/greenplum/replace.sql,sha256=Pk9g-3SBC78bB_s8ECh_6tPDqTvL1wxKNjzrTakfrL0,1976
|
|
36
|
+
dbhose_airflow/move/postgres/delete.sql,sha256=OJJqu3CmbipMUl_Oyw48yzRSfzchzyu4YAcu9gAscFc,502
|
|
37
|
+
dbhose_airflow/move/postgres/replace.sql,sha256=Pk9g-3SBC78bB_s8ECh_6tPDqTvL1wxKNjzrTakfrL0,1976
|
|
38
|
+
dbhose_airflow-0.0.2.3.dist-info/licenses/CHANGELOG.md,sha256=SjlBfmhyPa2L_nrn-Km1m-lIRSHcbL8DlkHWrBffd3w,1004
|
|
39
|
+
dbhose_airflow-0.0.2.3.dist-info/licenses/README.md,sha256=-TsSFVS-bdRMNM-xhtqiZUXyD6D_lb6Uiz8LKEPGlP0,8822
|
|
40
|
+
dbhose_airflow-0.0.2.3.dist-info/METADATA,sha256=rH5mtbEzU37u9HGsrLURekKxu4flzZxN-aDK66gjfEI,9434
|
|
41
|
+
dbhose_airflow-0.0.2.3.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
42
|
+
dbhose_airflow-0.0.2.3.dist-info/top_level.txt,sha256=VlTXT0CLGGcVhbG9QPw2_a8H5UV03QMjvZ-NrPy6_jM,15
|
|
43
|
+
dbhose_airflow-0.0.2.3.dist-info/RECORD,,
|
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# Version History
|
|
2
2
|
|
|
3
|
+
## 0.0.2.3
|
|
4
|
+
|
|
5
|
+
* Update depends pgpack-dumper==0.3.3.2
|
|
6
|
+
* Fix write_between diagram for Postgres/Greenplum objects
|
|
7
|
+
|
|
8
|
+
## 0.0.2.2
|
|
9
|
+
|
|
10
|
+
* Fix include_package_data
|
|
11
|
+
|
|
3
12
|
## 0.0.2.1
|
|
4
13
|
|
|
5
14
|
* Add MoveMethod.rewrite for full rewrite table with new data
|
|
@@ -1,12 +0,0 @@
|
|
|
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,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|