anysite-cli 0.1.5__py3-none-any.whl → 0.1.6__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.
- anysite/dataset/db_loader.py +10 -3
- {anysite_cli-0.1.5.dist-info → anysite_cli-0.1.6.dist-info}/METADATA +1 -1
- {anysite_cli-0.1.5.dist-info → anysite_cli-0.1.6.dist-info}/RECORD +6 -6
- {anysite_cli-0.1.5.dist-info → anysite_cli-0.1.6.dist-info}/WHEEL +0 -0
- {anysite_cli-0.1.5.dist-info → anysite_cli-0.1.6.dist-info}/entry_points.txt +0 -0
- {anysite_cli-0.1.5.dist-info → anysite_cli-0.1.6.dist-info}/licenses/LICENSE +0 -0
anysite/dataset/db_loader.py
CHANGED
|
@@ -326,13 +326,14 @@ class DatasetDbLoader:
|
|
|
326
326
|
total += 1
|
|
327
327
|
|
|
328
328
|
# DELETE removed records (skipped in append mode)
|
|
329
|
+
ph = self._placeholder()
|
|
329
330
|
if result.removed and sync_mode == "full":
|
|
330
331
|
safe_col = sanitize_identifier(db_key_col)
|
|
331
332
|
for record in result.removed:
|
|
332
333
|
key_val = _get_key_val(record)
|
|
333
334
|
if key_val is not None:
|
|
334
335
|
self.adapter.execute(
|
|
335
|
-
f"DELETE FROM {table_name} WHERE {safe_col} =
|
|
336
|
+
f"DELETE FROM {table_name} WHERE {safe_col} = {ph}",
|
|
336
337
|
(str(key_val),),
|
|
337
338
|
)
|
|
338
339
|
total += 1
|
|
@@ -354,14 +355,14 @@ class DatasetDbLoader:
|
|
|
354
355
|
for field_name in changed_fields:
|
|
355
356
|
new_val = record.get(field_name)
|
|
356
357
|
safe_field = sanitize_identifier(field_name)
|
|
357
|
-
set_parts.append(f"{safe_field} =
|
|
358
|
+
set_parts.append(f"{safe_field} = {ph}")
|
|
358
359
|
params.append(new_val)
|
|
359
360
|
|
|
360
361
|
params.append(str(key_val))
|
|
361
362
|
sql = (
|
|
362
363
|
f"UPDATE {table_name} "
|
|
363
364
|
f"SET {', '.join(set_parts)} "
|
|
364
|
-
f"WHERE {safe_col} =
|
|
365
|
+
f"WHERE {safe_col} = {ph}"
|
|
365
366
|
)
|
|
366
367
|
self.adapter.execute(sql, tuple(params))
|
|
367
368
|
total += 1
|
|
@@ -375,6 +376,12 @@ class DatasetDbLoader:
|
|
|
375
376
|
return other.dependency.field
|
|
376
377
|
return None
|
|
377
378
|
|
|
379
|
+
def _placeholder(self) -> str:
|
|
380
|
+
"""Get the parameter placeholder for the dialect."""
|
|
381
|
+
if self._dialect == "postgres":
|
|
382
|
+
return "%s"
|
|
383
|
+
return "?"
|
|
384
|
+
|
|
378
385
|
def _auto_id_type(self) -> str:
|
|
379
386
|
"""Get the auto-increment ID column type for the dialect."""
|
|
380
387
|
if self._dialect == "postgres":
|
|
@@ -21,7 +21,7 @@ anysite/dataset/__init__.py,sha256=J0sKQkGwVOPtvp6pka7LcdeUEADvjWRs71yRuROzJxI,8
|
|
|
21
21
|
anysite/dataset/analyzer.py,sha256=8dsPW32SbSaUTy1F0NIed1U45wjiMgQeJ2iWX7hBxRQ,9245
|
|
22
22
|
anysite/dataset/cli.py,sha256=rEWK1ka-YQ_Vbbj2nMaMYTD9g3wa3ethUWSoaWRSGTY,23066
|
|
23
23
|
anysite/dataset/collector.py,sha256=ZdR3CmQQew_iuJpNtJ4knSrjt0hvkEL4WIaS0IKEkwQ,23927
|
|
24
|
-
anysite/dataset/db_loader.py,sha256=
|
|
24
|
+
anysite/dataset/db_loader.py,sha256=ASDO5AD5_wcOxjR4DZknX-zMEaevqXMb3VVa6507qAg,13973
|
|
25
25
|
anysite/dataset/differ.py,sha256=jB_VWTb7UuEBWG9nv1ry5xeo9hmWdhA_cTm6Ed43_Uw,17746
|
|
26
26
|
anysite/dataset/errors.py,sha256=r8cZXoIzSeTGCWpeYjntnN0AduCu74YZyWs3sFu17J4,914
|
|
27
27
|
anysite/dataset/exporters.py,sha256=mA2FYbYJbHfrwkXbHDu4g5qPG_JJKnkVciXFKPkF1Vw,3708
|
|
@@ -58,8 +58,8 @@ anysite/streaming/writer.py,sha256=HfMsC4umUdJuNIAPK57YAxEGyTwUmy-zNrqFkwY6aew,4
|
|
|
58
58
|
anysite/utils/__init__.py,sha256=7SnbxpxKENK-2ecUL5NfnZ9okGI7COKYw4WF46172HM,23
|
|
59
59
|
anysite/utils/fields.py,sha256=bSrHadzNmabL4qubqhXXZoWb_P8KA-3S7_FLVT8nGBc,7410
|
|
60
60
|
anysite/utils/retry.py,sha256=89TbXvavi5t22P2mTYCLAS6SSZoW65gQ0nnYNbYAF0M,2684
|
|
61
|
-
anysite_cli-0.1.
|
|
62
|
-
anysite_cli-0.1.
|
|
63
|
-
anysite_cli-0.1.
|
|
64
|
-
anysite_cli-0.1.
|
|
65
|
-
anysite_cli-0.1.
|
|
61
|
+
anysite_cli-0.1.6.dist-info/METADATA,sha256=iqEFoJcISFAZoeT96LrCHiCVPqWk4WX1Xy41siFqUzs,12437
|
|
62
|
+
anysite_cli-0.1.6.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
|
|
63
|
+
anysite_cli-0.1.6.dist-info/entry_points.txt,sha256=FDPxNasy0fRRcOgJdZRVP7Qw01C3TwRa1OwPJiskNyg,45
|
|
64
|
+
anysite_cli-0.1.6.dist-info/licenses/LICENSE,sha256=gVAxkI23CFm4x4HV_fkQYw_bGq93mQmVZEwxNs-YTa4,1069
|
|
65
|
+
anysite_cli-0.1.6.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|