execsql2 2.16.16__py3-none-any.whl → 2.16.17__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 +22 -4
- {execsql2-2.16.16.dist-info → execsql2-2.16.17.dist-info}/METADATA +1 -1
- {execsql2-2.16.16.dist-info → execsql2-2.16.17.dist-info}/RECORD +22 -22
- {execsql2-2.16.16.data → execsql2-2.16.17.data}/data/execsql2_extras/README.md +0 -0
- {execsql2-2.16.16.data → execsql2-2.16.17.data}/data/execsql2_extras/config_settings.sqlite +0 -0
- {execsql2-2.16.16.data → execsql2-2.16.17.data}/data/execsql2_extras/example_config_prompt.sql +0 -0
- {execsql2-2.16.16.data → execsql2-2.16.17.data}/data/execsql2_extras/execsql.conf +0 -0
- {execsql2-2.16.16.data → execsql2-2.16.17.data}/data/execsql2_extras/make_config_db.sql +0 -0
- {execsql2-2.16.16.data → execsql2-2.16.17.data}/data/execsql2_extras/md_compare.sql +0 -0
- {execsql2-2.16.16.data → execsql2-2.16.17.data}/data/execsql2_extras/md_glossary.sql +0 -0
- {execsql2-2.16.16.data → execsql2-2.16.17.data}/data/execsql2_extras/md_upsert.sql +0 -0
- {execsql2-2.16.16.data → execsql2-2.16.17.data}/data/execsql2_extras/pg_compare.sql +0 -0
- {execsql2-2.16.16.data → execsql2-2.16.17.data}/data/execsql2_extras/pg_glossary.sql +0 -0
- {execsql2-2.16.16.data → execsql2-2.16.17.data}/data/execsql2_extras/pg_upsert.sql +0 -0
- {execsql2-2.16.16.data → execsql2-2.16.17.data}/data/execsql2_extras/script_template.sql +0 -0
- {execsql2-2.16.16.data → execsql2-2.16.17.data}/data/execsql2_extras/ss_compare.sql +0 -0
- {execsql2-2.16.16.data → execsql2-2.16.17.data}/data/execsql2_extras/ss_glossary.sql +0 -0
- {execsql2-2.16.16.data → execsql2-2.16.17.data}/data/execsql2_extras/ss_upsert.sql +0 -0
- {execsql2-2.16.16.dist-info → execsql2-2.16.17.dist-info}/WHEEL +0 -0
- {execsql2-2.16.16.dist-info → execsql2-2.16.17.dist-info}/entry_points.txt +0 -0
- {execsql2-2.16.16.dist-info → execsql2-2.16.17.dist-info}/licenses/LICENSE.txt +0 -0
- {execsql2-2.16.16.dist-info → execsql2-2.16.17.dist-info}/licenses/NOTICE +0 -0
execsql/format.py
CHANGED
|
@@ -82,6 +82,14 @@ BLOCK_CLOSE = frozenset({"ENDIF", "END LOOP", "ENDLOOP", "END SCRIPT", "END BATC
|
|
|
82
82
|
PIVOT = frozenset({"ELSE", "ELSEIF"}) # decrease depth before emit, increase after
|
|
83
83
|
CONTINUATION = frozenset({"ANDIF", "ORIF"}) # emit at depth-1, no depth change
|
|
84
84
|
|
|
85
|
+
# Inline IF: "IF (cond) { command }" — self-contained, no ENDIF, no depth change.
|
|
86
|
+
# Mirrors src/execsql/cli/lint.py:_RX_IF_INLINE so formatter and linter agree.
|
|
87
|
+
_IF_INLINE_RE = re.compile(r"^\s*IF\s*\(\s*.+\s*\)\s*\{.+\}\s*$", re.I)
|
|
88
|
+
# BLOCK_OPEN keywords whose bodies are guaranteed-SQL (not metacommand-driven).
|
|
89
|
+
# Blank lines inside these belong to the SQL accumulator, not the output stream.
|
|
90
|
+
_SQL_BODY_BLOCKS = frozenset({"BEGIN SQL", "BEGIN BATCH"})
|
|
91
|
+
_SQL_BODY_BLOCK_CLOSES = frozenset({"END SQL", "END BATCH"})
|
|
92
|
+
|
|
85
93
|
|
|
86
94
|
# ---------------------------------------------------------------------------
|
|
87
95
|
# Keyword parsing
|
|
@@ -488,6 +496,10 @@ def format_file(source: str, indent: int = 4, use_sql: bool = True, leading_comm
|
|
|
488
496
|
# the accumulator — doing so would split a single statement into
|
|
489
497
|
# fragments that sqlglot cannot parse.
|
|
490
498
|
in_sql_statement = False
|
|
499
|
+
# True between BEGIN SQL/BATCH and END SQL/BATCH. Blank lines inside
|
|
500
|
+
# these blocks belong to the SQL accumulator so they re-emit at the
|
|
501
|
+
# block's indent depth, not flush-left in the output stream.
|
|
502
|
+
in_explicit_sql_block = False
|
|
491
503
|
|
|
492
504
|
def flush_sql() -> None:
|
|
493
505
|
nonlocal in_dollar_quote, in_sql_statement
|
|
@@ -520,12 +532,13 @@ def format_file(source: str, indent: int = 4, use_sql: bool = True, leading_comm
|
|
|
520
532
|
m = METACOMMAND_RE.match(raw_line)
|
|
521
533
|
|
|
522
534
|
if not stripped_line:
|
|
523
|
-
if not in_dollar_quote and not in_sql_statement:
|
|
535
|
+
if not in_dollar_quote and not in_sql_statement and not in_explicit_sql_block:
|
|
524
536
|
flush_sql()
|
|
525
537
|
output.append("")
|
|
526
538
|
else:
|
|
527
|
-
# Mid-statement blank line stays in
|
|
528
|
-
# will appear in the output
|
|
539
|
+
# Mid-statement OR mid-explicit-SQL-block blank line stays in
|
|
540
|
+
# the accumulator and will appear in the output at the block's
|
|
541
|
+
# indent depth when the SQL is formatted.
|
|
529
542
|
sql_acc.append(raw_line)
|
|
530
543
|
|
|
531
544
|
elif m:
|
|
@@ -536,6 +549,8 @@ def format_file(source: str, indent: int = 4, use_sql: bool = True, leading_comm
|
|
|
536
549
|
if keyword in BLOCK_CLOSE:
|
|
537
550
|
depth = max(0, depth - 1)
|
|
538
551
|
output.append(format_metacommand(payload, depth, indent))
|
|
552
|
+
if keyword in _SQL_BODY_BLOCK_CLOSES:
|
|
553
|
+
in_explicit_sql_block = False
|
|
539
554
|
|
|
540
555
|
elif keyword in PIVOT:
|
|
541
556
|
depth = max(0, depth - 1)
|
|
@@ -547,7 +562,10 @@ def format_file(source: str, indent: int = 4, use_sql: bool = True, leading_comm
|
|
|
547
562
|
|
|
548
563
|
elif keyword in BLOCK_OPEN:
|
|
549
564
|
output.append(format_metacommand(payload, depth, indent))
|
|
550
|
-
|
|
565
|
+
if not (keyword == "IF" and _IF_INLINE_RE.match(payload)):
|
|
566
|
+
depth += 1
|
|
567
|
+
if keyword in _SQL_BODY_BLOCKS:
|
|
568
|
+
in_explicit_sql_block = True
|
|
551
569
|
|
|
552
570
|
else:
|
|
553
571
|
output.append(format_metacommand(payload, depth, indent))
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: execsql2
|
|
3
|
-
Version: 2.16.
|
|
3
|
+
Version: 2.16.17
|
|
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
|
|
@@ -3,7 +3,7 @@ execsql/__main__.py,sha256=HdbK-SAhyUmfB6xINY5AzxdMSxGzWSGEG_2dv42Jn64,315
|
|
|
3
3
|
execsql/api.py,sha256=6Jw5p89DYZXyoDFGk5mE4UyVUGLok5DUdhikpUy39RE,19928
|
|
4
4
|
execsql/config.py,sha256=nJwcFiDaEnvqLX4hBjYkH7WW8HmMq5F3sLoqIFJCayU,29614
|
|
5
5
|
execsql/exceptions.py,sha256=j8hykBiof9H3Za9hwLIbDcVB2Xn65ODXXplp1jkvdgM,8453
|
|
6
|
-
execsql/format.py,sha256=
|
|
6
|
+
execsql/format.py,sha256=el_gQyMbj4VllToGEcU_61PtxUFotD1hXjrVzEhackM,25507
|
|
7
7
|
execsql/models.py,sha256=kCTUQg9-vReM6WNFfB_ZrEppuOW5u1uMBQThSkfPC0o,13264
|
|
8
8
|
execsql/parser.py,sha256=P3ea8k7T_XLMrbhpFNZXwytdShrY302MKnhosqza1lo,15493
|
|
9
9
|
execsql/plugins.py,sha256=2voLwT6eFap6BCBoZYndNNC_bMEJO1f_aP6xQTVXwYI,12815
|
|
@@ -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.16.
|
|
105
|
-
execsql2-2.16.
|
|
106
|
-
execsql2-2.16.
|
|
107
|
-
execsql2-2.16.
|
|
108
|
-
execsql2-2.16.
|
|
109
|
-
execsql2-2.16.
|
|
110
|
-
execsql2-2.16.
|
|
111
|
-
execsql2-2.16.
|
|
112
|
-
execsql2-2.16.
|
|
113
|
-
execsql2-2.16.
|
|
114
|
-
execsql2-2.16.
|
|
115
|
-
execsql2-2.16.
|
|
116
|
-
execsql2-2.16.
|
|
117
|
-
execsql2-2.16.
|
|
118
|
-
execsql2-2.16.
|
|
119
|
-
execsql2-2.16.
|
|
120
|
-
execsql2-2.16.
|
|
121
|
-
execsql2-2.16.
|
|
122
|
-
execsql2-2.16.
|
|
123
|
-
execsql2-2.16.
|
|
124
|
-
execsql2-2.16.
|
|
104
|
+
execsql2-2.16.17.data/data/execsql2_extras/README.md,sha256=sxwVyU0ZahCfANv56LahkyuM505kFjrMhe-1SvWE69E,4845
|
|
105
|
+
execsql2-2.16.17.data/data/execsql2_extras/config_settings.sqlite,sha256=aY5cxR7Q7J6zJ4bC9lu5mHUrhy211Cq3MNKPQVCt02E,20480
|
|
106
|
+
execsql2-2.16.17.data/data/execsql2_extras/example_config_prompt.sql,sha256=SY3Jxn1qcVm4kPW9xmmTfknHfvURXmeEYTbRjYrjGSw,7487
|
|
107
|
+
execsql2-2.16.17.data/data/execsql2_extras/execsql.conf,sha256=1a2g2Vga7s128wcu3ftIFRkHlKKtuvkuOHSD1XuNT7o,9404
|
|
108
|
+
execsql2-2.16.17.data/data/execsql2_extras/make_config_db.sql,sha256=WwyC6dK-Eh5CAVppiBCDHqiI1_wEI9U95Ytpr4lsZkg,8726
|
|
109
|
+
execsql2-2.16.17.data/data/execsql2_extras/md_compare.sql,sha256=B8Wd7LZ0vnMY2qvA139JIEBkPObgRH2i5xj6PejTQt8,24092
|
|
110
|
+
execsql2-2.16.17.data/data/execsql2_extras/md_glossary.sql,sha256=DJRHcU5NbFpxTTX-IwH3yRlsboj1q6BBGrUAHKn4Cuo,10796
|
|
111
|
+
execsql2-2.16.17.data/data/execsql2_extras/md_upsert.sql,sha256=v_7GbWh_N1mBTmw3gvTrkagOVp2q0KmXvM8hE-DlFxY,112524
|
|
112
|
+
execsql2-2.16.17.data/data/execsql2_extras/pg_compare.sql,sha256=9dWa8hnfy5dVJI-z2iGpd9JzQmI4j2ziMlEdpnr66ro,24352
|
|
113
|
+
execsql2-2.16.17.data/data/execsql2_extras/pg_glossary.sql,sha256=pKjIIDsROAgJq2H-1qNEcRMAWManivcZ_AEVHzUUlic,9908
|
|
114
|
+
execsql2-2.16.17.data/data/execsql2_extras/pg_upsert.sql,sha256=k7AFiGTLBy3nf-qO5QIaZrEYTAKvdxxU3JDLx9jqkzs,108315
|
|
115
|
+
execsql2-2.16.17.data/data/execsql2_extras/script_template.sql,sha256=1Estacb_vm1FgK41k_G9nuduP1yiA-fQ1Kn4Z4mv5Ao,11153
|
|
116
|
+
execsql2-2.16.17.data/data/execsql2_extras/ss_compare.sql,sha256=TsVxWm3cEpR5-EiMYXNhtaY0arSNeKZhsJdHdLA7xeI,24833
|
|
117
|
+
execsql2-2.16.17.data/data/execsql2_extras/ss_glossary.sql,sha256=cLM7nN8JOIu9ZVP9oY9qdSK3hrnWJiDcX6nZmQQbQWI,13065
|
|
118
|
+
execsql2-2.16.17.data/data/execsql2_extras/ss_upsert.sql,sha256=BCqmBykXBF-BpCgOFeG1qhf2XfScKsxPD17wd1hYfHw,120647
|
|
119
|
+
execsql2-2.16.17.dist-info/METADATA,sha256=7pPGd_axbrqgbRC0tkMvO81O93KMUB_GaVlki6wIzOY,20921
|
|
120
|
+
execsql2-2.16.17.dist-info/WHEEL,sha256=QccIxa26bgl1E6uMy58deGWi-0aeIkkangHcxk2kWfw,87
|
|
121
|
+
execsql2-2.16.17.dist-info/entry_points.txt,sha256=sUOxkM-dN1eBGGpSpDLsAaE0yNXYQKWZAfxPOlMkQyk,90
|
|
122
|
+
execsql2-2.16.17.dist-info/licenses/LICENSE.txt,sha256=LBdhuxejF8_bLCHZ2kWfmDXpDGUu914Gbd6_3JjCRe0,676
|
|
123
|
+
execsql2-2.16.17.dist-info/licenses/NOTICE,sha256=sqVrM73Ys9zfvWC_P797lHfTnoPW_ETeBSrUTFaob0A,339
|
|
124
|
+
execsql2-2.16.17.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
{execsql2-2.16.16.data → execsql2-2.16.17.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
|