execsql2 2.22.2__py3-none-any.whl → 2.22.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.
- execsql/format.py +12 -1
- {execsql2-2.22.2.dist-info → execsql2-2.22.3.dist-info}/METADATA +2 -2
- {execsql2-2.22.2.dist-info → execsql2-2.22.3.dist-info}/RECORD +21 -21
- {execsql2-2.22.2.data → execsql2-2.22.3.data}/data/execsql2_extras/README.md +0 -0
- {execsql2-2.22.2.data → execsql2-2.22.3.data}/data/execsql2_extras/config_settings.sqlite +0 -0
- {execsql2-2.22.2.data → execsql2-2.22.3.data}/data/execsql2_extras/example_config_prompt.sql +0 -0
- {execsql2-2.22.2.data → execsql2-2.22.3.data}/data/execsql2_extras/make_config_db.sql +0 -0
- {execsql2-2.22.2.data → execsql2-2.22.3.data}/data/execsql2_extras/md_compare.sql +0 -0
- {execsql2-2.22.2.data → execsql2-2.22.3.data}/data/execsql2_extras/md_glossary.sql +0 -0
- {execsql2-2.22.2.data → execsql2-2.22.3.data}/data/execsql2_extras/md_upsert.sql +0 -0
- {execsql2-2.22.2.data → execsql2-2.22.3.data}/data/execsql2_extras/pg_compare.sql +0 -0
- {execsql2-2.22.2.data → execsql2-2.22.3.data}/data/execsql2_extras/pg_glossary.sql +0 -0
- {execsql2-2.22.2.data → execsql2-2.22.3.data}/data/execsql2_extras/pg_upsert.sql +0 -0
- {execsql2-2.22.2.data → execsql2-2.22.3.data}/data/execsql2_extras/script_template.sql +0 -0
- {execsql2-2.22.2.data → execsql2-2.22.3.data}/data/execsql2_extras/ss_compare.sql +0 -0
- {execsql2-2.22.2.data → execsql2-2.22.3.data}/data/execsql2_extras/ss_glossary.sql +0 -0
- {execsql2-2.22.2.data → execsql2-2.22.3.data}/data/execsql2_extras/ss_upsert.sql +0 -0
- {execsql2-2.22.2.dist-info → execsql2-2.22.3.dist-info}/WHEEL +0 -0
- {execsql2-2.22.2.dist-info → execsql2-2.22.3.dist-info}/entry_points.txt +0 -0
- {execsql2-2.22.2.dist-info → execsql2-2.22.3.dist-info}/licenses/LICENSE.txt +0 -0
- {execsql2-2.22.2.dist-info → execsql2-2.22.3.dist-info}/licenses/NOTICE +0 -0
execsql/format.py
CHANGED
|
@@ -642,6 +642,12 @@ def format_file(source: str, indent: int = 4, use_sql: bool = True, leading_comm
|
|
|
642
642
|
# "body" for `$body$`, etc.). Nested markers with a different tag
|
|
643
643
|
# are ignored — only a matching close marker re-opens us.
|
|
644
644
|
current_dq_tag: str | None = None
|
|
645
|
+
# Sticky flag: True once the current accumulator has seen ANY dollar-quote
|
|
646
|
+
# marker. `in_dollar_quote` alone is False by the time a complete
|
|
647
|
+
# `CREATE FUNCTION ... $$ ... $$;` is flushed (the closing `$$` reset it),
|
|
648
|
+
# which would wrongly hand the PL/pgSQL body to sqlglot. This flag keeps the
|
|
649
|
+
# whole containing statement opaque to sqlglot. Reset in flush_sql().
|
|
650
|
+
sql_acc_contains_dollar_quote = False
|
|
645
651
|
in_block_comment = False
|
|
646
652
|
# Track whether we are inside an open SQL statement (last SQL line
|
|
647
653
|
# did not end with ';'). Blank lines mid-statement should NOT flush
|
|
@@ -655,15 +661,19 @@ def format_file(source: str, indent: int = 4, use_sql: bool = True, leading_comm
|
|
|
655
661
|
|
|
656
662
|
def flush_sql() -> None:
|
|
657
663
|
nonlocal in_dollar_quote, current_dq_tag, in_sql_statement
|
|
664
|
+
nonlocal sql_acc_contains_dollar_quote
|
|
658
665
|
if sql_acc:
|
|
659
666
|
# If any line in the accumulated block is inside a $$-delimited
|
|
660
667
|
# region, skip sqlglot formatting entirely. PL/pgSQL function
|
|
661
668
|
# bodies contain IF/END IF, LOOP, RETURN, etc. that sqlglot does
|
|
662
669
|
# not understand and will corrupt (e.g., rewriting to COMMIT).
|
|
663
|
-
|
|
670
|
+
# `sql_acc_contains_dollar_quote` catches the case where the region
|
|
671
|
+
# already closed (`... $$;`) so `in_dollar_quote` is False at flush.
|
|
672
|
+
safe_for_sqlglot = use_sql and not in_dollar_quote and not sql_acc_contains_dollar_quote
|
|
664
673
|
output.extend(format_sql_block(sql_acc, depth, indent, safe_for_sqlglot, leading_comma=leading_comma))
|
|
665
674
|
sql_acc.clear()
|
|
666
675
|
in_sql_statement = False
|
|
676
|
+
sql_acc_contains_dollar_quote = False
|
|
667
677
|
|
|
668
678
|
for raw_line in source.expandtabs(4).splitlines():
|
|
669
679
|
stripped_line = raw_line.strip()
|
|
@@ -727,6 +737,7 @@ def format_file(source: str, indent: int = 4, use_sql: bool = True, leading_comm
|
|
|
727
737
|
# PL/pgSQL. Walk every dollar-quote marker on the line; toggle
|
|
728
738
|
# state only when we hit the matching open or close.
|
|
729
739
|
for m in _DOLLAR_QUOTE_RE.finditer(raw_line):
|
|
740
|
+
sql_acc_contains_dollar_quote = True
|
|
730
741
|
tag = m.group(1) or ""
|
|
731
742
|
if not in_dollar_quote:
|
|
732
743
|
in_dollar_quote = True
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: execsql2
|
|
3
|
-
Version: 2.22.
|
|
3
|
+
Version: 2.22.3
|
|
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
|
|
@@ -384,7 +384,7 @@ execsql-format --no-sql --in-place scripts/
|
|
|
384
384
|
```yaml
|
|
385
385
|
repos:
|
|
386
386
|
- repo: https://github.com/geocoug/execsql
|
|
387
|
-
rev: v2.22.
|
|
387
|
+
rev: v2.22.3
|
|
388
388
|
hooks:
|
|
389
389
|
- id: execsql-format
|
|
390
390
|
```
|
|
@@ -3,7 +3,7 @@ execsql/__main__.py,sha256=HdbK-SAhyUmfB6xINY5AzxdMSxGzWSGEG_2dv42Jn64,315
|
|
|
3
3
|
execsql/api.py,sha256=EOtBwMnm-8fmB_KmvxyjglR6C7CjdYhCPBisJ9CFfJg,22227
|
|
4
4
|
execsql/config.py,sha256=txKziUJLV7UPonj2sGFgkmlinDdSV50aHmR_cuCbEIo,34369
|
|
5
5
|
execsql/exceptions.py,sha256=GlphAiR8iZu4UR4U50WgSqEUMd9_8AeQJ_hhPcJOeQU,9381
|
|
6
|
-
execsql/format.py,sha256=
|
|
6
|
+
execsql/format.py,sha256=3w-m0EsHapBdSKx6oTFWYlXspFLdUR_RF79gMvHhrqQ,34440
|
|
7
7
|
execsql/models.py,sha256=-DWTVrPNwM-n1h3e3rXMoBv9-wpWVdZahyy4RB7fRRE,15502
|
|
8
8
|
execsql/parser.py,sha256=aOxZ7Mzgvk7G4-nvy9Bgz7xlaZm6oo81cffDeBk_LCk,15597
|
|
9
9
|
execsql/plugins.py,sha256=l82VWa5NpvOQWD6vcO-WKP-vtn0wp9__wWDFAbwxZg0,12838
|
|
@@ -101,23 +101,23 @@ execsql/utils/numeric.py,sha256=_7bi5R6pHjMCkOPne_Sh5nUj-B8e9g6WFmjptFHaunA,1573
|
|
|
101
101
|
execsql/utils/regex.py,sha256=B3mSBhRRx_DpUnX_t9IoYd05KvWAebiLMCZqQAmEwcw,3885
|
|
102
102
|
execsql/utils/strings.py,sha256=UQNjpRCEFa1UO6feU-M-9e24wWAvizs_iu_4fFusLxo,8516
|
|
103
103
|
execsql/utils/timer.py,sha256=eDYf5VzCNFk7oo90InJucUm3XcBdhYMogjZMqeg9xzc,1899
|
|
104
|
-
execsql2-2.22.
|
|
105
|
-
execsql2-2.22.
|
|
106
|
-
execsql2-2.22.
|
|
107
|
-
execsql2-2.22.
|
|
108
|
-
execsql2-2.22.
|
|
109
|
-
execsql2-2.22.
|
|
110
|
-
execsql2-2.22.
|
|
111
|
-
execsql2-2.22.
|
|
112
|
-
execsql2-2.22.
|
|
113
|
-
execsql2-2.22.
|
|
114
|
-
execsql2-2.22.
|
|
115
|
-
execsql2-2.22.
|
|
116
|
-
execsql2-2.22.
|
|
117
|
-
execsql2-2.22.
|
|
118
|
-
execsql2-2.22.
|
|
119
|
-
execsql2-2.22.
|
|
120
|
-
execsql2-2.22.
|
|
121
|
-
execsql2-2.22.
|
|
122
|
-
execsql2-2.22.
|
|
123
|
-
execsql2-2.22.
|
|
104
|
+
execsql2-2.22.3.data/data/execsql2_extras/README.md,sha256=vX4NTL095dUoA_hesyRMGYBorEZ_Y_tJ9qrd-MVV09I,5032
|
|
105
|
+
execsql2-2.22.3.data/data/execsql2_extras/config_settings.sqlite,sha256=aY5cxR7Q7J6zJ4bC9lu5mHUrhy211Cq3MNKPQVCt02E,20480
|
|
106
|
+
execsql2-2.22.3.data/data/execsql2_extras/example_config_prompt.sql,sha256=2e8KzzVWhho8KxYVHETSVmZdhW7wodioDsqBLSL6m4s,7487
|
|
107
|
+
execsql2-2.22.3.data/data/execsql2_extras/make_config_db.sql,sha256=WwyC6dK-Eh5CAVppiBCDHqiI1_wEI9U95Ytpr4lsZkg,8726
|
|
108
|
+
execsql2-2.22.3.data/data/execsql2_extras/md_compare.sql,sha256=qYYVAjSeHZzjszxV3Bv6bg8Ckbq2kMHl87_gh4sywMU,24140
|
|
109
|
+
execsql2-2.22.3.data/data/execsql2_extras/md_glossary.sql,sha256=hkZ2Onn57LAKKsuXxzhR8tPtcWXkmWEQkwPE58-Tm2k,10796
|
|
110
|
+
execsql2-2.22.3.data/data/execsql2_extras/md_upsert.sql,sha256=_CAK4BzEboRXTNy03SJR-oOjcEdSNMuRBPL6noWUptY,112560
|
|
111
|
+
execsql2-2.22.3.data/data/execsql2_extras/pg_compare.sql,sha256=1zJd4hVUKHR0tncc2qTBC9B4qVV4Us2ITkJpsjN3tMw,24352
|
|
112
|
+
execsql2-2.22.3.data/data/execsql2_extras/pg_glossary.sql,sha256=IKuwna-_8b20ljSkXZruuiQigrCpo7ueQdUqd1MXiuI,9908
|
|
113
|
+
execsql2-2.22.3.data/data/execsql2_extras/pg_upsert.sql,sha256=HpPJtTHvpEjQy03j-3iPxDEOHMRkudOg7O4D4YR38UI,108315
|
|
114
|
+
execsql2-2.22.3.data/data/execsql2_extras/script_template.sql,sha256=2J35ddZPguJ-vwTsz83wErv0jiWUyJcdW_JM0mNKDXA,11155
|
|
115
|
+
execsql2-2.22.3.data/data/execsql2_extras/ss_compare.sql,sha256=j1qVNUPXQsEU7-DoVgDJCGcE0EuIl7whLBT3fgeiMAo,24833
|
|
116
|
+
execsql2-2.22.3.data/data/execsql2_extras/ss_glossary.sql,sha256=2gLxv34xzKt0vy7hSzJH7a9JiMC3ETrv9MofxQwAibU,13065
|
|
117
|
+
execsql2-2.22.3.data/data/execsql2_extras/ss_upsert.sql,sha256=G_8rQ0VzuKIZHWs24O_WrfzpC5S27R1JsL-bFBR3SUQ,117730
|
|
118
|
+
execsql2-2.22.3.dist-info/METADATA,sha256=gSLoVf2cJOEScG6F8dJdIk7uVWiXwd_uVzRKgYdJVgY,20382
|
|
119
|
+
execsql2-2.22.3.dist-info/WHEEL,sha256=lCkmxWfQsSc9CfIClYeavTdQeEX2toPqufh9gI35EQA,87
|
|
120
|
+
execsql2-2.22.3.dist-info/entry_points.txt,sha256=sUOxkM-dN1eBGGpSpDLsAaE0yNXYQKWZAfxPOlMkQyk,90
|
|
121
|
+
execsql2-2.22.3.dist-info/licenses/LICENSE.txt,sha256=LBdhuxejF8_bLCHZ2kWfmDXpDGUu914Gbd6_3JjCRe0,676
|
|
122
|
+
execsql2-2.22.3.dist-info/licenses/NOTICE,sha256=McYzgxYav3U1OaVsY4Su1sfBrfmplpRdA9b6-gCDQCg,342
|
|
123
|
+
execsql2-2.22.3.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
{execsql2-2.22.2.data → execsql2-2.22.3.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
|