execsql2 2.39.1__py3-none-any.whl → 2.41.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/__init__.py +4 -2
- execsql/api.py +40 -27
- execsql/cli/commands/__init__.py +1 -0
- execsql/cli/commands/inspect.py +292 -0
- execsql/cli/dispatch.py +3 -3
- execsql/cli/inspection.py +276 -0
- execsql/cli/lint.py +3 -4
- execsql/cli/options.py +15 -7
- execsql/config.py +15 -2
- execsql/db/access.py +6 -5
- execsql/db/base.py +14 -0
- execsql/db/dsn.py +3 -2
- execsql/db/duckdb.py +2 -1
- execsql/db/firebird.py +3 -2
- execsql/db/mysql.py +3 -2
- execsql/db/oracle.py +3 -2
- execsql/db/postgres.py +3 -2
- execsql/db/sqlite.py +2 -1
- execsql/db/sqlserver.py +3 -2
- execsql/ddl.py +310 -0
- execsql/exporters/xls.py +18 -4
- execsql/file_inspection.py +393 -0
- execsql/importers/base.py +19 -12
- execsql/importers/feather.py +16 -21
- execsql/importers/json.py +26 -32
- execsql/importers/xls.py +9 -4
- execsql/metacommands/control.py +21 -23
- execsql/metacommands/script_ext.py +6 -2
- execsql/schema.py +816 -0
- execsql/script/executor.py +11 -0
- execsql/script/parser.py +31 -0
- execsql/script/variables.py +14 -2
- execsql/utils/errors.py +21 -3
- {execsql2-2.39.1.data → execsql2-2.41.0.data}/data/execsql2_extras/README.md +7 -0
- execsql2-2.41.0.data/data/execsql2_extras/inspect/README.md +116 -0
- execsql2-2.41.0.data/data/execsql2_extras/inspect/make_demo.py +106 -0
- {execsql2-2.39.1.dist-info → execsql2-2.41.0.dist-info}/METADATA +84 -19
- {execsql2-2.39.1.dist-info → execsql2-2.41.0.dist-info}/RECORD +54 -47
- {execsql2-2.39.1.data → execsql2-2.41.0.data}/data/execsql2_extras/config_settings.sqlite +0 -0
- {execsql2-2.39.1.data → execsql2-2.41.0.data}/data/execsql2_extras/example_config_prompt.sql +0 -0
- {execsql2-2.39.1.data → execsql2-2.41.0.data}/data/execsql2_extras/make_config_db.sql +0 -0
- {execsql2-2.39.1.data → execsql2-2.41.0.data}/data/execsql2_extras/md_compare.sql +0 -0
- {execsql2-2.39.1.data → execsql2-2.41.0.data}/data/execsql2_extras/md_glossary.sql +0 -0
- {execsql2-2.39.1.data → execsql2-2.41.0.data}/data/execsql2_extras/md_upsert.sql +0 -0
- {execsql2-2.39.1.data → execsql2-2.41.0.data}/data/execsql2_extras/pg_compare.sql +0 -0
- {execsql2-2.39.1.data → execsql2-2.41.0.data}/data/execsql2_extras/pg_glossary.sql +0 -0
- {execsql2-2.39.1.data → execsql2-2.41.0.data}/data/execsql2_extras/script_template.sql +0 -0
- {execsql2-2.39.1.data → execsql2-2.41.0.data}/data/execsql2_extras/ss_compare.sql +0 -0
- {execsql2-2.39.1.data → execsql2-2.41.0.data}/data/execsql2_extras/ss_glossary.sql +0 -0
- {execsql2-2.39.1.data → execsql2-2.41.0.data}/data/execsql2_extras/ss_upsert.sql +0 -0
- {execsql2-2.39.1.dist-info → execsql2-2.41.0.dist-info}/WHEEL +0 -0
- {execsql2-2.39.1.dist-info → execsql2-2.41.0.dist-info}/entry_points.txt +0 -0
- {execsql2-2.39.1.dist-info → execsql2-2.41.0.dist-info}/licenses/LICENSE.txt +0 -0
- {execsql2-2.39.1.dist-info → execsql2-2.41.0.dist-info}/licenses/NOTICE +0 -0
execsql/metacommands/control.py
CHANGED
|
@@ -85,54 +85,52 @@ def x_assert(**kwargs: Any) -> None:
|
|
|
85
85
|
raise ErrInfo(type="assert", other_msg=message)
|
|
86
86
|
|
|
87
87
|
|
|
88
|
-
def
|
|
89
|
-
"""
|
|
90
|
-
|
|
91
|
-
These handlers stay registered in the dispatch table so ``execsql list
|
|
92
|
-
keywords`` and the VS Code grammar generator still see the keyword. The AST parser converts the source form (``IF`` / ``ENDIF`` /
|
|
93
|
-
``LOOP`` / ``BEGIN BATCH`` / ``BREAK`` / ``ELSE`` / ``ELSEIF`` / ``ANDIF``
|
|
94
|
-
/ ``ORIF``) into structural AST nodes that the executor walks directly —
|
|
95
|
-
none of these dispatch handlers fire for parsed scripts. Reaching one
|
|
96
|
-
means the AST parser failed to recognise the keyword, which is a bug.
|
|
97
|
-
"""
|
|
98
|
-
from execsql.exceptions import ErrInfo
|
|
88
|
+
def unsupported_block_error(name: str) -> ErrInfo:
|
|
89
|
+
"""Explain a block boundary supplied dynamically instead of in source.
|
|
99
90
|
|
|
91
|
+
The dispatch entries also keep structural keywords discoverable. They
|
|
92
|
+
can be reached by variable text or an inline IF containing a boundary;
|
|
93
|
+
this is an unsupported script form, not an internal parser failure.
|
|
94
|
+
"""
|
|
100
95
|
return ErrInfo(
|
|
101
96
|
type="cmd",
|
|
102
|
-
other_msg=
|
|
97
|
+
other_msg=(
|
|
98
|
+
f"{name} cannot run here; write the complete block directly in the script. "
|
|
99
|
+
"To append a block, define it with BEGIN SCRIPT and use EXTEND SCRIPT ... WITH SCRIPT."
|
|
100
|
+
),
|
|
103
101
|
)
|
|
104
102
|
|
|
105
103
|
|
|
106
104
|
def x_if(**kwargs: Any) -> None:
|
|
107
|
-
raise
|
|
105
|
+
raise unsupported_block_error("IF")
|
|
108
106
|
|
|
109
107
|
|
|
110
108
|
def x_if_orif(**kwargs: Any) -> None:
|
|
111
|
-
raise
|
|
109
|
+
raise unsupported_block_error("ORIF")
|
|
112
110
|
|
|
113
111
|
|
|
114
112
|
def x_if_andif(**kwargs: Any) -> None:
|
|
115
|
-
raise
|
|
113
|
+
raise unsupported_block_error("ANDIF")
|
|
116
114
|
|
|
117
115
|
|
|
118
116
|
def x_if_elseif(**kwargs: Any) -> None:
|
|
119
|
-
raise
|
|
117
|
+
raise unsupported_block_error("ELSEIF")
|
|
120
118
|
|
|
121
119
|
|
|
122
120
|
def x_if_else(**kwargs: Any) -> None:
|
|
123
|
-
raise
|
|
121
|
+
raise unsupported_block_error("ELSE")
|
|
124
122
|
|
|
125
123
|
|
|
126
124
|
def x_if_block(**kwargs: Any) -> None:
|
|
127
|
-
raise
|
|
125
|
+
raise unsupported_block_error("IF")
|
|
128
126
|
|
|
129
127
|
|
|
130
128
|
def x_if_end(**kwargs: Any) -> None:
|
|
131
|
-
raise
|
|
129
|
+
raise unsupported_block_error("ENDIF")
|
|
132
130
|
|
|
133
131
|
|
|
134
132
|
def x_loop(**kwargs: Any) -> None:
|
|
135
|
-
raise
|
|
133
|
+
raise unsupported_block_error("LOOP")
|
|
136
134
|
|
|
137
135
|
|
|
138
136
|
def x_halt(**kwargs: Any) -> None:
|
|
@@ -191,11 +189,11 @@ def x_metacommand_error_halt(**kwargs: Any) -> None:
|
|
|
191
189
|
|
|
192
190
|
|
|
193
191
|
def x_begin_batch(**kwargs: Any) -> None:
|
|
194
|
-
raise
|
|
192
|
+
raise unsupported_block_error("BEGIN BATCH")
|
|
195
193
|
|
|
196
194
|
|
|
197
195
|
def x_end_batch(**kwargs: Any) -> None:
|
|
198
|
-
raise
|
|
196
|
+
raise unsupported_block_error("END BATCH")
|
|
199
197
|
|
|
200
198
|
|
|
201
199
|
def x_rollback(**kwargs: Any) -> None:
|
|
@@ -204,7 +202,7 @@ def x_rollback(**kwargs: Any) -> None:
|
|
|
204
202
|
|
|
205
203
|
|
|
206
204
|
def x_break(**kwargs: Any) -> None:
|
|
207
|
-
raise
|
|
205
|
+
raise unsupported_block_error("BREAK")
|
|
208
206
|
|
|
209
207
|
|
|
210
208
|
def x_wait_until(**kwargs: Any) -> None:
|
|
@@ -69,12 +69,16 @@ def x_extendscript(**kwargs: Any) -> None:
|
|
|
69
69
|
|
|
70
70
|
def x_extendscript_metacommand(**kwargs: Any) -> None:
|
|
71
71
|
"""Append a single metacommand line to an existing SCRIPT body."""
|
|
72
|
-
from execsql.
|
|
72
|
+
from execsql.metacommands.control import unsupported_block_error
|
|
73
|
+
from execsql.script.parser import block_metacommand_name, metacommand_node
|
|
73
74
|
|
|
74
75
|
block = _get_ast_script(kwargs["script"])
|
|
76
|
+
command = kwargs["cmd"].strip()
|
|
77
|
+
if name := block_metacommand_name(command):
|
|
78
|
+
raise unsupported_block_error(name)
|
|
75
79
|
script_file, script_line_no = current_script_line()
|
|
76
80
|
span = _new_span(script_file, script_line_no or 0)
|
|
77
|
-
block.body.append(metacommand_node(
|
|
81
|
+
block.body.append(metacommand_node(command, span))
|
|
78
82
|
|
|
79
83
|
|
|
80
84
|
def x_extendscript_sql(**kwargs: Any) -> None:
|