execsql2 2.16.18__py3-none-any.whl → 2.17.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.
- execsql/metacommands/upsert.py +0 -29
- execsql/script/executor.py +12 -8
- {execsql2-2.16.18.dist-info → execsql2-2.17.0.dist-info}/METADATA +1 -1
- {execsql2-2.16.18.dist-info → execsql2-2.17.0.dist-info}/RECORD +23 -23
- {execsql2-2.16.18.data → execsql2-2.17.0.data}/data/execsql2_extras/README.md +0 -0
- {execsql2-2.16.18.data → execsql2-2.17.0.data}/data/execsql2_extras/config_settings.sqlite +0 -0
- {execsql2-2.16.18.data → execsql2-2.17.0.data}/data/execsql2_extras/example_config_prompt.sql +0 -0
- {execsql2-2.16.18.data → execsql2-2.17.0.data}/data/execsql2_extras/execsql.conf +0 -0
- {execsql2-2.16.18.data → execsql2-2.17.0.data}/data/execsql2_extras/make_config_db.sql +0 -0
- {execsql2-2.16.18.data → execsql2-2.17.0.data}/data/execsql2_extras/md_compare.sql +0 -0
- {execsql2-2.16.18.data → execsql2-2.17.0.data}/data/execsql2_extras/md_glossary.sql +0 -0
- {execsql2-2.16.18.data → execsql2-2.17.0.data}/data/execsql2_extras/md_upsert.sql +0 -0
- {execsql2-2.16.18.data → execsql2-2.17.0.data}/data/execsql2_extras/pg_compare.sql +0 -0
- {execsql2-2.16.18.data → execsql2-2.17.0.data}/data/execsql2_extras/pg_glossary.sql +0 -0
- {execsql2-2.16.18.data → execsql2-2.17.0.data}/data/execsql2_extras/pg_upsert.sql +0 -0
- {execsql2-2.16.18.data → execsql2-2.17.0.data}/data/execsql2_extras/script_template.sql +0 -0
- {execsql2-2.16.18.data → execsql2-2.17.0.data}/data/execsql2_extras/ss_compare.sql +0 -0
- {execsql2-2.16.18.data → execsql2-2.17.0.data}/data/execsql2_extras/ss_glossary.sql +0 -0
- {execsql2-2.16.18.data → execsql2-2.17.0.data}/data/execsql2_extras/ss_upsert.sql +0 -0
- {execsql2-2.16.18.dist-info → execsql2-2.17.0.dist-info}/WHEEL +0 -0
- {execsql2-2.16.18.dist-info → execsql2-2.17.0.dist-info}/entry_points.txt +0 -0
- {execsql2-2.16.18.dist-info → execsql2-2.17.0.dist-info}/licenses/LICENSE.txt +0 -0
- {execsql2-2.16.18.dist-info → execsql2-2.17.0.dist-info}/licenses/NOTICE +0 -0
execsql/metacommands/upsert.py
CHANGED
|
@@ -201,14 +201,6 @@ def _set_subvars(result: Any) -> None:
|
|
|
201
201
|
sv("$PG_UPSERT_EXPORT_PATH", "")
|
|
202
202
|
|
|
203
203
|
|
|
204
|
-
def _qa_failure_msg(result: Any) -> str:
|
|
205
|
-
"""Build a concise QA failure message listing which tables failed."""
|
|
206
|
-
failed = [t.table_name for t in result.tables if not t.qa_passed]
|
|
207
|
-
if failed:
|
|
208
|
-
return f"PG_UPSERT QA failed for: {', '.join(failed)}"
|
|
209
|
-
return "PG_UPSERT QA checks failed."
|
|
210
|
-
|
|
211
|
-
|
|
212
204
|
# ---------------------------------------------------------------------------
|
|
213
205
|
# Import guard + helpers
|
|
214
206
|
# ---------------------------------------------------------------------------
|
|
@@ -484,13 +476,6 @@ def x_pg_upsert(**kwargs: Any) -> None:
|
|
|
484
476
|
if opts.get("cleanup"):
|
|
485
477
|
ups.cleanup()
|
|
486
478
|
|
|
487
|
-
if not result.qa_passed:
|
|
488
|
-
raise ErrInfo(
|
|
489
|
-
"cmd",
|
|
490
|
-
command_text=metacommandline,
|
|
491
|
-
other_msg=_qa_failure_msg(result),
|
|
492
|
-
)
|
|
493
|
-
|
|
494
479
|
|
|
495
480
|
def x_pg_upsert_qa(**kwargs: Any) -> None:
|
|
496
481
|
"""PG_UPSERT QA FROM <staging> TO <base> TABLES <t1>, <t2> [options]
|
|
@@ -524,13 +509,6 @@ def x_pg_upsert_qa(**kwargs: Any) -> None:
|
|
|
524
509
|
if opts.get("cleanup"):
|
|
525
510
|
ups.cleanup()
|
|
526
511
|
|
|
527
|
-
if not result.qa_passed:
|
|
528
|
-
raise ErrInfo(
|
|
529
|
-
"cmd",
|
|
530
|
-
command_text=metacommandline,
|
|
531
|
-
other_msg=_qa_failure_msg(result),
|
|
532
|
-
)
|
|
533
|
-
|
|
534
512
|
|
|
535
513
|
def x_pg_upsert_check(**kwargs: Any) -> None:
|
|
536
514
|
"""PG_UPSERT CHECK FROM <staging> TO <base> TABLES <t1>, <t2>
|
|
@@ -567,13 +545,6 @@ def x_pg_upsert_check(**kwargs: Any) -> None:
|
|
|
567
545
|
if opts.get("cleanup"):
|
|
568
546
|
ups.cleanup()
|
|
569
547
|
|
|
570
|
-
if not result.qa_passed:
|
|
571
|
-
raise ErrInfo(
|
|
572
|
-
"cmd",
|
|
573
|
-
command_text=metacommandline,
|
|
574
|
-
other_msg=_qa_failure_msg(result),
|
|
575
|
-
)
|
|
576
|
-
|
|
577
548
|
|
|
578
549
|
# ---------------------------------------------------------------------------
|
|
579
550
|
# Plugin registration
|
execsql/script/executor.py
CHANGED
|
@@ -243,15 +243,17 @@ def _exec_sql(
|
|
|
243
243
|
|
|
244
244
|
def _exec_metacommand(
|
|
245
245
|
ctx: RuntimeContext,
|
|
246
|
-
|
|
246
|
+
cmd: str,
|
|
247
247
|
source: str,
|
|
248
248
|
line_no: int,
|
|
249
|
-
localvars: SubVarSet | None = None,
|
|
250
249
|
) -> Any:
|
|
251
|
-
"""Dispatch a metacommand through the dispatch table.
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
250
|
+
"""Dispatch a metacommand through the dispatch table.
|
|
251
|
+
|
|
252
|
+
*cmd* must already have ``!!$VAR!!`` substitution applied. The caller is
|
|
253
|
+
responsible for expansion so that side-effecting substitutions (counter
|
|
254
|
+
increments, ``$RANDOM``, ``$UUID``) are evaluated exactly once per
|
|
255
|
+
metacommand reference.
|
|
256
|
+
"""
|
|
255
257
|
if _VARLIKE.search(cmd):
|
|
256
258
|
ctx.output.write(
|
|
257
259
|
f"Warning: There is a potential un-substituted variable in the command\n {cmd}\n",
|
|
@@ -355,13 +357,15 @@ def _execute_node(
|
|
|
355
357
|
command = node.command
|
|
356
358
|
if in_loop:
|
|
357
359
|
command = _convert_deferred_vars(command)
|
|
358
|
-
#
|
|
360
|
+
# Substitute once: the same expanded text is used for BREAK detection
|
|
361
|
+
# and dispatch. Calling substitute_vars twice would double-increment
|
|
362
|
+
# !!$COUNTER_N!! and re-roll !!$RANDOM!!/!!$UUID!! references.
|
|
359
363
|
effective_locals = _stack_localvars(ctx) or localvars
|
|
360
364
|
expanded = substitute_vars(command, effective_locals, ctx=ctx)
|
|
361
365
|
if _BREAK_RX.match(expanded):
|
|
362
366
|
raise _BreakLoop
|
|
363
367
|
ctx.last_command = _FakeScriptCmd(node)
|
|
364
|
-
_exec_metacommand(ctx,
|
|
368
|
+
_exec_metacommand(ctx, expanded, node.span.file, node.span.start_line)
|
|
365
369
|
|
|
366
370
|
elif isinstance(node, IfBlock):
|
|
367
371
|
ctx.last_command = _FakeScriptCmd(node)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: execsql2
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.17.0
|
|
4
4
|
Summary: Runs a SQL script against a PostgreSQL, SQLite, MariaDB/MySQL, DuckDB, Firebird, MS-Access, MS-SQL-Server, or Oracle database, or an ODBC DSN. Provides metacommands to import and export data, copy data between databases, conditionally execute SQL and metacommands, and dynamically alter SQL and metacommands with substitution variables.
|
|
5
5
|
Project-URL: Homepage, https://execsql2.readthedocs.io
|
|
6
6
|
Project-URL: Repository, https://github.com/geocoug/execsql
|
|
@@ -81,12 +81,12 @@ execsql/metacommands/io_write.py,sha256=eayUxsLnEDqp2R5iqlEjeOK8DxyoOFkG9hBe2JkV
|
|
|
81
81
|
execsql/metacommands/prompt.py,sha256=E2e7q4pxbl_wEBrhco0B2gm5hO_HG3rNIF75PLdTgGg,36767
|
|
82
82
|
execsql/metacommands/script_ext.py,sha256=sw4YKUQl0SRlVlmhIoGbMokOo_hVqh1EcTuYCN7c4kM,2396
|
|
83
83
|
execsql/metacommands/system.py,sha256=cuyGebDR-ysVWjZRVYJLSGWhxfQWcFHroutCPySiad0,7375
|
|
84
|
-
execsql/metacommands/upsert.py,sha256=
|
|
84
|
+
execsql/metacommands/upsert.py,sha256=wzoMpM8g49pEvU9GkHZ62fPvqV3w1UIUfxVA7HAsS_o,20317
|
|
85
85
|
execsql/script/__init__.py,sha256=3WaBklMVIWjtCsYQ-BVo9UAVEIATOgeGsuyv21YKnxo,3969
|
|
86
86
|
execsql/script/ast.py,sha256=AviMXseSpZtaPpJtJEs3olaXuk23kN_dU5raHbymy6s,20266
|
|
87
87
|
execsql/script/control.py,sha256=s-1eZdGARM6H1FwZ6VDdO_f50j7bvvRtTHesfUm9tbc,6144
|
|
88
88
|
execsql/script/engine.py,sha256=EhuVBniOrFkzAW4I3NIZLt3INHTZJvlYoF7B99rZBLI,29391
|
|
89
|
-
execsql/script/executor.py,sha256=
|
|
89
|
+
execsql/script/executor.py,sha256=0YW8G_pZqa-S1a8hEoRUMVAbsJF8PSXSwdctKG17tuU,37840
|
|
90
90
|
execsql/script/parser.py,sha256=-7v6yJIYgTHyYzE57fy-xEoLy--NWFnQsbAvGh17cqY,33825
|
|
91
91
|
execsql/script/variables.py,sha256=ZSBGQUsoii6w3dLDVY9xxoPIV6wY0sAV_BNIQ6pgQAE,14328
|
|
92
92
|
execsql/utils/__init__.py,sha256=0uR6JwVJQRX3vceByNBduCAf5dd5assKjeqJUWvpZoA,278
|
|
@@ -101,24 +101,24 @@ execsql/utils/numeric.py,sha256=xh02ANSRk3nUpQ-rtm66ILoMqoi7HtzCoRMIOT9U8QI,1570
|
|
|
101
101
|
execsql/utils/regex.py,sha256=diEzTZqU_HHwVMadPAvN1Vgzhl7I03eVaEFGCXyGGL8,3770
|
|
102
102
|
execsql/utils/strings.py,sha256=5Dvzrk-9SIw2lpxXZQkiJbNyo1sy7iXXAtSULlZ0KG8,8488
|
|
103
103
|
execsql/utils/timer.py,sha256=eDYf5VzCNFk7oo90InJucUm3XcBdhYMogjZMqeg9xzc,1899
|
|
104
|
-
execsql2-2.
|
|
105
|
-
execsql2-2.
|
|
106
|
-
execsql2-2.
|
|
107
|
-
execsql2-2.
|
|
108
|
-
execsql2-2.
|
|
109
|
-
execsql2-2.
|
|
110
|
-
execsql2-2.
|
|
111
|
-
execsql2-2.
|
|
112
|
-
execsql2-2.
|
|
113
|
-
execsql2-2.
|
|
114
|
-
execsql2-2.
|
|
115
|
-
execsql2-2.
|
|
116
|
-
execsql2-2.
|
|
117
|
-
execsql2-2.
|
|
118
|
-
execsql2-2.
|
|
119
|
-
execsql2-2.
|
|
120
|
-
execsql2-2.
|
|
121
|
-
execsql2-2.
|
|
122
|
-
execsql2-2.
|
|
123
|
-
execsql2-2.
|
|
124
|
-
execsql2-2.
|
|
104
|
+
execsql2-2.17.0.data/data/execsql2_extras/README.md,sha256=sxwVyU0ZahCfANv56LahkyuM505kFjrMhe-1SvWE69E,4845
|
|
105
|
+
execsql2-2.17.0.data/data/execsql2_extras/config_settings.sqlite,sha256=aY5cxR7Q7J6zJ4bC9lu5mHUrhy211Cq3MNKPQVCt02E,20480
|
|
106
|
+
execsql2-2.17.0.data/data/execsql2_extras/example_config_prompt.sql,sha256=SY3Jxn1qcVm4kPW9xmmTfknHfvURXmeEYTbRjYrjGSw,7487
|
|
107
|
+
execsql2-2.17.0.data/data/execsql2_extras/execsql.conf,sha256=1a2g2Vga7s128wcu3ftIFRkHlKKtuvkuOHSD1XuNT7o,9404
|
|
108
|
+
execsql2-2.17.0.data/data/execsql2_extras/make_config_db.sql,sha256=WwyC6dK-Eh5CAVppiBCDHqiI1_wEI9U95Ytpr4lsZkg,8726
|
|
109
|
+
execsql2-2.17.0.data/data/execsql2_extras/md_compare.sql,sha256=B8Wd7LZ0vnMY2qvA139JIEBkPObgRH2i5xj6PejTQt8,24092
|
|
110
|
+
execsql2-2.17.0.data/data/execsql2_extras/md_glossary.sql,sha256=DJRHcU5NbFpxTTX-IwH3yRlsboj1q6BBGrUAHKn4Cuo,10796
|
|
111
|
+
execsql2-2.17.0.data/data/execsql2_extras/md_upsert.sql,sha256=v_7GbWh_N1mBTmw3gvTrkagOVp2q0KmXvM8hE-DlFxY,112524
|
|
112
|
+
execsql2-2.17.0.data/data/execsql2_extras/pg_compare.sql,sha256=9dWa8hnfy5dVJI-z2iGpd9JzQmI4j2ziMlEdpnr66ro,24352
|
|
113
|
+
execsql2-2.17.0.data/data/execsql2_extras/pg_glossary.sql,sha256=pKjIIDsROAgJq2H-1qNEcRMAWManivcZ_AEVHzUUlic,9908
|
|
114
|
+
execsql2-2.17.0.data/data/execsql2_extras/pg_upsert.sql,sha256=k7AFiGTLBy3nf-qO5QIaZrEYTAKvdxxU3JDLx9jqkzs,108315
|
|
115
|
+
execsql2-2.17.0.data/data/execsql2_extras/script_template.sql,sha256=1Estacb_vm1FgK41k_G9nuduP1yiA-fQ1Kn4Z4mv5Ao,11153
|
|
116
|
+
execsql2-2.17.0.data/data/execsql2_extras/ss_compare.sql,sha256=TsVxWm3cEpR5-EiMYXNhtaY0arSNeKZhsJdHdLA7xeI,24833
|
|
117
|
+
execsql2-2.17.0.data/data/execsql2_extras/ss_glossary.sql,sha256=cLM7nN8JOIu9ZVP9oY9qdSK3hrnWJiDcX6nZmQQbQWI,13065
|
|
118
|
+
execsql2-2.17.0.data/data/execsql2_extras/ss_upsert.sql,sha256=BCqmBykXBF-BpCgOFeG1qhf2XfScKsxPD17wd1hYfHw,120647
|
|
119
|
+
execsql2-2.17.0.dist-info/METADATA,sha256=KHC9DTyU7haKukUTn6bHYgwkpXDNLq_lffErzmLCajo,20920
|
|
120
|
+
execsql2-2.17.0.dist-info/WHEEL,sha256=QccIxa26bgl1E6uMy58deGWi-0aeIkkangHcxk2kWfw,87
|
|
121
|
+
execsql2-2.17.0.dist-info/entry_points.txt,sha256=sUOxkM-dN1eBGGpSpDLsAaE0yNXYQKWZAfxPOlMkQyk,90
|
|
122
|
+
execsql2-2.17.0.dist-info/licenses/LICENSE.txt,sha256=LBdhuxejF8_bLCHZ2kWfmDXpDGUu914Gbd6_3JjCRe0,676
|
|
123
|
+
execsql2-2.17.0.dist-info/licenses/NOTICE,sha256=sqVrM73Ys9zfvWC_P797lHfTnoPW_ETeBSrUTFaob0A,339
|
|
124
|
+
execsql2-2.17.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
{execsql2-2.16.18.data → execsql2-2.17.0.data}/data/execsql2_extras/example_config_prompt.sql
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|