tracktolib 0.55.0__py3-none-any.whl → 0.56.0__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.
- tracktolib/pg_sync.py +13 -10
- {tracktolib-0.55.0.dist-info → tracktolib-0.56.0.dist-info}/METADATA +1 -1
- {tracktolib-0.55.0.dist-info → tracktolib-0.56.0.dist-info}/RECORD +5 -5
- {tracktolib-0.55.0.dist-info → tracktolib-0.56.0.dist-info}/WHEEL +1 -1
- {tracktolib-0.55.0.dist-info → tracktolib-0.56.0.dist-info}/LICENSE +0 -0
tracktolib/pg_sync.py
CHANGED
|
@@ -14,7 +14,6 @@ except ImportError:
|
|
|
14
14
|
|
|
15
15
|
from .pg_utils import get_tmp_table_query
|
|
16
16
|
|
|
17
|
-
|
|
18
17
|
__all__ = (
|
|
19
18
|
"clean_tables",
|
|
20
19
|
"drop_db",
|
|
@@ -81,11 +80,15 @@ def get_insert_data(table: LiteralString, data: list[dict]) -> tuple[LiteralStri
|
|
|
81
80
|
return query, [tuple(_parse_value(_x) for _x in x.values()) for x in data]
|
|
82
81
|
|
|
83
82
|
|
|
84
|
-
def insert_many(engine: Connection, table: LiteralString, data: list[dict]):
|
|
83
|
+
def insert_many(engine: Connection | Cursor, table: LiteralString, data: list[dict]):
|
|
85
84
|
query, _data = get_insert_data(table, data)
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
85
|
+
if isinstance(engine, Connection):
|
|
86
|
+
with engine.cursor() as cur:
|
|
87
|
+
_ = cur.executemany(query, _data)
|
|
88
|
+
engine.commit()
|
|
89
|
+
else:
|
|
90
|
+
# If we are using a cursor, we can use executemany directly
|
|
91
|
+
_ = engine.executemany(query, _data)
|
|
89
92
|
|
|
90
93
|
|
|
91
94
|
@overload
|
|
@@ -138,11 +141,11 @@ def clean_tables(engine: Connection, tables: Iterable[LiteralString], reset_seq:
|
|
|
138
141
|
|
|
139
142
|
def get_tables(engine: Connection, schemas: list[str], ignored_tables: Iterable[str] | None = None):
|
|
140
143
|
table_query = """
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
144
|
+
SELECT CONCAT_WS('.', schemaname, tablename) AS table
|
|
145
|
+
FROM pg_catalog.pg_tables
|
|
146
|
+
WHERE schemaname = ANY (%s)
|
|
147
|
+
ORDER BY schemaname, tablename \
|
|
148
|
+
"""
|
|
146
149
|
resp = fetch_all(engine, table_query, schemas)
|
|
147
150
|
|
|
148
151
|
# Foreign keys
|
|
@@ -5,14 +5,14 @@ tracktolib/logs.py,sha256=xgfRDnviZPr9qinSOgab8neIWPv9Rj2xzDHnIBvWQcU,2201
|
|
|
5
5
|
tracktolib/pg/__init__.py,sha256=j67e3B3gBbCHLD20QBybptmNdbbVMzNhZE6XjIPuKVo,349
|
|
6
6
|
tracktolib/pg/query.py,sha256=MBYOTL9aLnYRBhaLy8-P6uGNXOmyluejNyUdt3Gfx5M,14504
|
|
7
7
|
tracktolib/pg/utils.py,sha256=cL24KEt4SWJQ7LJPzaO3c8Xg0ZLmjhn22DtTWg86nwc,6324
|
|
8
|
-
tracktolib/pg_sync.py,sha256=
|
|
8
|
+
tracktolib/pg_sync.py,sha256=82fh2XUlH55veWkdIRfirOSjGUWwK759U51ZsBXc2_U,6214
|
|
9
9
|
tracktolib/pg_utils.py,sha256=VXPpy1jGq6aCgTlfFJDIrq6JDujR83JN5ZRiCi8Lx4E,2582
|
|
10
10
|
tracktolib/s3/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
11
11
|
tracktolib/s3/minio.py,sha256=wMEjkSes9Fp39fD17IctALpD6zB2xwDRQEmO7Vzan3g,1387
|
|
12
12
|
tracktolib/s3/s3.py,sha256=0HbSAPoaup5-W4LK54zRCjrQ5mr8OWR-N9WjW99Q4aw,5937
|
|
13
13
|
tracktolib/tests.py,sha256=gKE--epQjgMZGXc5ydbl4zjOdmwztJS42UMV0p4hXEA,399
|
|
14
14
|
tracktolib/utils.py,sha256=ysTBF9V35fVXQVBPk0kfE_84SGRxzrayqmg9RbtoJq4,5761
|
|
15
|
-
tracktolib-0.
|
|
16
|
-
tracktolib-0.
|
|
17
|
-
tracktolib-0.
|
|
18
|
-
tracktolib-0.
|
|
15
|
+
tracktolib-0.56.0.dist-info/LICENSE,sha256=uUanH0X7SeZEPdsRTHegMSMTiIHMurt9H0jSwEwKE1Y,1081
|
|
16
|
+
tracktolib-0.56.0.dist-info/METADATA,sha256=kigOjHx1QJ-xf6L0tUnhJUiZiYMB6VDGso-yzuspREk,3704
|
|
17
|
+
tracktolib-0.56.0.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
|
|
18
|
+
tracktolib-0.56.0.dist-info/RECORD,,
|
|
File without changes
|