ingestify 0.6.2__py3-none-any.whl → 0.6.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.
- ingestify/__init__.py +1 -1
- ingestify/infra/store/dataset/sqlalchemy/repository.py +23 -10
- {ingestify-0.6.2.dist-info → ingestify-0.6.3.dist-info}/METADATA +1 -1
- {ingestify-0.6.2.dist-info → ingestify-0.6.3.dist-info}/RECORD +7 -7
- {ingestify-0.6.2.dist-info → ingestify-0.6.3.dist-info}/WHEEL +0 -0
- {ingestify-0.6.2.dist-info → ingestify-0.6.3.dist-info}/entry_points.txt +0 -0
- {ingestify-0.6.2.dist-info → ingestify-0.6.3.dist-info}/top_level.txt +0 -0
ingestify/__init__.py
CHANGED
|
@@ -152,7 +152,13 @@ class SqlAlchemyDatasetRepository(DatasetRepository):
|
|
|
152
152
|
def dialect(self) -> Dialect:
|
|
153
153
|
return self.session_provider.dialect
|
|
154
154
|
|
|
155
|
-
def _upsert(
|
|
155
|
+
def _upsert(
|
|
156
|
+
self,
|
|
157
|
+
connection: Connection,
|
|
158
|
+
table: Table,
|
|
159
|
+
entities: list[dict],
|
|
160
|
+
immutable_rows: bool = False,
|
|
161
|
+
):
|
|
156
162
|
dialect = self.dialect.name
|
|
157
163
|
if dialect == "mysql":
|
|
158
164
|
from sqlalchemy.dialects.mysql import insert
|
|
@@ -167,13 +173,18 @@ class SqlAlchemyDatasetRepository(DatasetRepository):
|
|
|
167
173
|
|
|
168
174
|
primary_key_columns = [column for column in table.columns if column.primary_key]
|
|
169
175
|
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
176
|
+
if immutable_rows:
|
|
177
|
+
stmt = stmt.on_conflict_do_nothing(index_elements=primary_key_columns)
|
|
178
|
+
else:
|
|
179
|
+
set_ = {
|
|
180
|
+
name: getattr(stmt.excluded, name)
|
|
181
|
+
for name, column in table.columns.items()
|
|
182
|
+
if column not in primary_key_columns
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
stmt = stmt.on_conflict_do_update(
|
|
186
|
+
index_elements=primary_key_columns, set_=set_
|
|
187
|
+
)
|
|
177
188
|
|
|
178
189
|
connection.execute(stmt)
|
|
179
190
|
|
|
@@ -476,8 +487,10 @@ class SqlAlchemyDatasetRepository(DatasetRepository):
|
|
|
476
487
|
with self.connect() as connection:
|
|
477
488
|
try:
|
|
478
489
|
self._upsert(connection, dataset_table, datasets_entities)
|
|
479
|
-
self._upsert(
|
|
480
|
-
|
|
490
|
+
self._upsert(
|
|
491
|
+
connection, revision_table, revision_entities, immutable_rows=True
|
|
492
|
+
)
|
|
493
|
+
self._upsert(connection, file_table, file_entities, immutable_rows=True)
|
|
481
494
|
except Exception:
|
|
482
495
|
connection.rollback()
|
|
483
496
|
raise
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
ingestify/__init__.py,sha256=
|
|
1
|
+
ingestify/__init__.py,sha256=CuCiGM6aFbNz1p2VC92CWR5tn9t7b_2nWoW7dlO4ADQ,301
|
|
2
2
|
ingestify/cmdline.py,sha256=JcveX6e4i6mJtIllhTuruwbqxyoKIITIWE8kB6byvJU,7721
|
|
3
3
|
ingestify/exceptions.py,sha256=izRzaLQmMy-4P8ZqGqVZyf4k6LFYOYqwYLuRaUH8BJw,187
|
|
4
4
|
ingestify/main.py,sha256=yYKA-4WAk04RdBCGmatsCKiPFQzpyufoG4VzHiWkVtU,8979
|
|
@@ -64,7 +64,7 @@ ingestify/infra/source/wyscout.py,sha256=DxCzdkzYpVRHTfV9GpF8pe3FzwIk-WHYUlea6nO
|
|
|
64
64
|
ingestify/infra/store/__init__.py,sha256=3dA6NWfB6FS5SFdQiSlJ0ZghBfnUAUuGIP5Vr4rkCqk,43
|
|
65
65
|
ingestify/infra/store/dataset/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
66
66
|
ingestify/infra/store/dataset/sqlalchemy/__init__.py,sha256=Z5JHWGO_hwT6rO-ecMOOAmOKjFFJi449KZvJTQgt6vQ,52
|
|
67
|
-
ingestify/infra/store/dataset/sqlalchemy/repository.py,sha256=
|
|
67
|
+
ingestify/infra/store/dataset/sqlalchemy/repository.py,sha256=8zMPA4jeAPNLXZ2zzpG9SClto8ysqgA341JYsZPQNHg,19812
|
|
68
68
|
ingestify/infra/store/dataset/sqlalchemy/tables.py,sha256=kALM32jbdeZ4Wn9gON-w2WSb5tH1lIWaBFgn5i29qTk,10635
|
|
69
69
|
ingestify/infra/store/file/__init__.py,sha256=DuEekZa2pmDuRCFiulbgoGotN0wGv3OrRXSvokY0PhY,104
|
|
70
70
|
ingestify/infra/store/file/dummy_file_repository.py,sha256=azUq9c43Mz9-GWk9j0E97BaqyUKu-ZMrcuaIednLq5E,723
|
|
@@ -80,8 +80,8 @@ ingestify/static/templates/wyscout/README.md,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRk
|
|
|
80
80
|
ingestify/static/templates/wyscout/config.yaml.jinja2,sha256=0zQXuvJVwd0oL2OJsPMZ8sOvRbdfRbieSGLQ44ezmYc,379
|
|
81
81
|
ingestify/static/templates/wyscout/query.py,sha256=wjAOMoKvhX-BzCRqEm1SJp6YAcF8Fsq7ddrOaOpAeOk,364
|
|
82
82
|
ingestify/static/templates/wyscout/database/README.md,sha256=7IuzjKo7Pqkx5wkmOETRZDljVOslqfA3ALuHMONq5dg,32
|
|
83
|
-
ingestify-0.6.
|
|
84
|
-
ingestify-0.6.
|
|
85
|
-
ingestify-0.6.
|
|
86
|
-
ingestify-0.6.
|
|
87
|
-
ingestify-0.6.
|
|
83
|
+
ingestify-0.6.3.dist-info/METADATA,sha256=-EpbTNkY4-qoUXCvfnM4Lpe_qdmNXGLm8SzL20kQ1AE,18854
|
|
84
|
+
ingestify-0.6.3.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
|
|
85
|
+
ingestify-0.6.3.dist-info/entry_points.txt,sha256=czYYXeX2ul4zdeB6bKlz3HaUF7zyVVcj9E_sRNDisI0,53
|
|
86
|
+
ingestify-0.6.3.dist-info/top_level.txt,sha256=Lwnjgns4KequS7KiicXhh6mLUvcdfjzLyPI4qf_s4A0,10
|
|
87
|
+
ingestify-0.6.3.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|