litedbmodel-runtime 2.0.2__tar.gz → 2.2.0__tar.gz
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.
- {litedbmodel_runtime-2.0.2 → litedbmodel_runtime-2.2.0}/PKG-INFO +2 -2
- litedbmodel_runtime-2.2.0/litedbmodel_runtime/__init__.py +253 -0
- litedbmodel_runtime-2.2.0/litedbmodel_runtime/connection_routing.py +974 -0
- litedbmodel_runtime-2.2.0/litedbmodel_runtime/driver.py +769 -0
- litedbmodel_runtime-2.2.0/litedbmodel_runtime/errors.py +192 -0
- litedbmodel_runtime-2.2.0/litedbmodel_runtime/exec_context.py +770 -0
- litedbmodel_runtime-2.2.0/litedbmodel_runtime/grouping.py +109 -0
- litedbmodel_runtime-2.2.0/litedbmodel_runtime/leaves.py +191 -0
- litedbmodel_runtime-2.2.0/litedbmodel_runtime/middleware.py +595 -0
- {litedbmodel_runtime-2.0.2 → litedbmodel_runtime-2.2.0}/litedbmodel_runtime/relation.py +76 -54
- litedbmodel_runtime-2.2.0/litedbmodel_runtime/runtime.py +320 -0
- {litedbmodel_runtime-2.0.2 → litedbmodel_runtime-2.2.0}/litedbmodel_runtime/static_bundle.py +135 -40
- litedbmodel_runtime-2.2.0/litedbmodel_runtime/tx_options.py +376 -0
- {litedbmodel_runtime-2.0.2 → litedbmodel_runtime-2.2.0}/litedbmodel_runtime.egg-info/PKG-INFO +2 -2
- {litedbmodel_runtime-2.0.2 → litedbmodel_runtime-2.2.0}/litedbmodel_runtime.egg-info/SOURCES.txt +19 -3
- {litedbmodel_runtime-2.0.2 → litedbmodel_runtime-2.2.0}/litedbmodel_runtime.egg-info/requires.txt +1 -1
- {litedbmodel_runtime-2.0.2 → litedbmodel_runtime-2.2.0}/pyproject.toml +2 -2
- litedbmodel_runtime-2.2.0/tests/test_conformance_corpus.py +77 -0
- litedbmodel_runtime-2.2.0/tests/test_connection_routing.py +396 -0
- litedbmodel_runtime-2.2.0/tests/test_connection_routing_livedb.py +603 -0
- {litedbmodel_runtime-2.0.2 → litedbmodel_runtime-2.2.0}/tests/test_consumes_bc_core.py +14 -6
- litedbmodel_runtime-2.2.0/tests/test_exec_context.py +433 -0
- litedbmodel_runtime-2.2.0/tests/test_grouping.py +194 -0
- litedbmodel_runtime-2.2.0/tests/test_hard_limit_guard.py +87 -0
- litedbmodel_runtime-2.2.0/tests/test_middleware.py +673 -0
- litedbmodel_runtime-2.2.0/tests/test_middleware_livedb.py +380 -0
- litedbmodel_runtime-2.2.0/tests/test_orm_bench_native.py +175 -0
- {litedbmodel_runtime-2.0.2 → litedbmodel_runtime-2.2.0}/tests/test_parallel_read.py +6 -5
- {litedbmodel_runtime-2.0.2 → litedbmodel_runtime-2.2.0}/tests/test_runtime.py +16 -24
- litedbmodel_runtime-2.2.0/tests/test_transaction_boundary.py +313 -0
- litedbmodel_runtime-2.2.0/tests/test_tx_boundary_livedb.py +530 -0
- litedbmodel_runtime-2.2.0/tests/test_tx_isolation.py +338 -0
- litedbmodel_runtime-2.2.0/tests/test_tx_options.py +177 -0
- litedbmodel_runtime-2.0.2/litedbmodel_runtime/__init__.py +0 -81
- litedbmodel_runtime-2.0.2/litedbmodel_runtime/driver.py +0 -479
- litedbmodel_runtime-2.0.2/litedbmodel_runtime/errors.py +0 -83
- litedbmodel_runtime-2.0.2/litedbmodel_runtime/livedb_runner.py +0 -262
- litedbmodel_runtime-2.0.2/litedbmodel_runtime/runtime.py +0 -218
- litedbmodel_runtime-2.0.2/litedbmodel_runtime/vectors_runner.py +0 -257
- litedbmodel_runtime-2.0.2/tests/test_conformance_corpus.py +0 -44
- {litedbmodel_runtime-2.0.2 → litedbmodel_runtime-2.2.0}/README.md +0 -0
- {litedbmodel_runtime-2.0.2 → litedbmodel_runtime-2.2.0}/litedbmodel_runtime/dialect.py +0 -0
- {litedbmodel_runtime-2.0.2 → litedbmodel_runtime-2.2.0}/litedbmodel_runtime.egg-info/dependency_links.txt +0 -0
- {litedbmodel_runtime-2.0.2 → litedbmodel_runtime-2.2.0}/litedbmodel_runtime.egg-info/top_level.txt +0 -0
- {litedbmodel_runtime-2.0.2 → litedbmodel_runtime-2.2.0}/setup.cfg +0 -0
- {litedbmodel_runtime-2.0.2 → litedbmodel_runtime-2.2.0}/tests/test_dialect.py +0 -0
- {litedbmodel_runtime-2.0.2 → litedbmodel_runtime-2.2.0}/tests/test_render.py +0 -0
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: litedbmodel-runtime
|
|
3
|
-
Version: 2.0
|
|
3
|
+
Version: 2.2.0
|
|
4
4
|
Summary: Thin multi-language runtime for litedbmodel v2 SCP makeSQL bundles (Python port). Executes the published static-makeSQL artifacts (a read ReadGraph = a bc surrogate ComponentGraphIR + per-node static statement templates, or a gate-first TransactionPlan) against a SQL driver — semantics-identical to the TS reference. Delegates the Expression-IR evaluation + map/Φ/wiring orchestration to behavior-contracts.
|
|
5
5
|
Author: foo-ogawa
|
|
6
6
|
License: MIT
|
|
7
7
|
Keywords: orm,sql,ir,runtime,conformance,litedbmodel
|
|
8
8
|
Requires-Python: >=3.9
|
|
9
9
|
Description-Content-Type: text/markdown
|
|
10
|
-
Requires-Dist: behavior-contracts==0.
|
|
10
|
+
Requires-Dist: behavior-contracts==0.11.17
|
|
11
11
|
Provides-Extra: test
|
|
12
12
|
Requires-Dist: pytest>=7.0; extra == "test"
|
|
13
13
|
Provides-Extra: livedb
|
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
"""litedbmodel v2 SCP — Python runtime (WS7b, #31).
|
|
2
|
+
|
|
3
|
+
The Python leg of the multi-language SCP runtime. It interprets the language-neutral §8 published
|
|
4
|
+
bundle (``SqlBundle``: sql text + fragment tree + closed-set Expression-IR param slots +
|
|
5
|
+
transaction plan, dialect-tagged) and executes it against a SQL driver, semantics-identical to
|
|
6
|
+
the TS reference (``src/scp``). The generic Expression-IR evaluation (SKIP guards, param slots)
|
|
7
|
+
and the plan/map/wire/output orchestration are delegated to the shared common core
|
|
8
|
+
``behavior-contracts`` (PyPI) — this package re-implements NO generic evaluator, only the
|
|
9
|
+
SQL-backend concerns (render → bind → execute → assembly + gate-first transaction), exactly like
|
|
10
|
+
the TS runtime.
|
|
11
|
+
"""
|
|
12
|
+
|
|
13
|
+
from __future__ import annotations
|
|
14
|
+
|
|
15
|
+
from .dialect import SQLITE, POSTGRES, MYSQL, Dialect, dialect_for, to_dollar_placeholders
|
|
16
|
+
from .driver import Driver, MysqlDriver, PostgresDriver, PreparedStatement, RunInfo, SqliteDriver, TxConnection
|
|
17
|
+
from .errors import LimitExceededError, SqlFailure, check_find_hard_limit, map_sqlite_error
|
|
18
|
+
from .exec_context import (
|
|
19
|
+
Connection,
|
|
20
|
+
ExecutionContext,
|
|
21
|
+
MiddlewareChain,
|
|
22
|
+
StatementIntent,
|
|
23
|
+
READ_INTENT,
|
|
24
|
+
WRITE_INTENT,
|
|
25
|
+
TxDecision,
|
|
26
|
+
ambient_in_transaction,
|
|
27
|
+
ambient_read_only,
|
|
28
|
+
as_context,
|
|
29
|
+
check_write_allowed_ambient,
|
|
30
|
+
commit,
|
|
31
|
+
context_for_driver,
|
|
32
|
+
current_context,
|
|
33
|
+
execute,
|
|
34
|
+
rollback,
|
|
35
|
+
run,
|
|
36
|
+
run_guarded,
|
|
37
|
+
run_with_pinned_context,
|
|
38
|
+
transaction,
|
|
39
|
+
with_transaction,
|
|
40
|
+
with_transaction_decided,
|
|
41
|
+
)
|
|
42
|
+
from .tx_options import (
|
|
43
|
+
IsolationLevel,
|
|
44
|
+
TransactionOptions,
|
|
45
|
+
WriteInReadOnlyContextError,
|
|
46
|
+
WriteOutsideTransactionError,
|
|
47
|
+
begin_statements,
|
|
48
|
+
check_write_allowed,
|
|
49
|
+
is_connection_error,
|
|
50
|
+
is_retryable_tx_error,
|
|
51
|
+
isolation_prelude,
|
|
52
|
+
)
|
|
53
|
+
from .middleware import (
|
|
54
|
+
LogEntry,
|
|
55
|
+
Logger,
|
|
56
|
+
METHOD_KINDS,
|
|
57
|
+
MethodKind,
|
|
58
|
+
MiddlewareConfig,
|
|
59
|
+
MiddlewareDescriptor,
|
|
60
|
+
MiddlewareHandle,
|
|
61
|
+
RawResult,
|
|
62
|
+
Registry,
|
|
63
|
+
SqlHook,
|
|
64
|
+
active_sql_middlewares,
|
|
65
|
+
clear_middlewares,
|
|
66
|
+
create_middleware,
|
|
67
|
+
current_registry,
|
|
68
|
+
raw_execute,
|
|
69
|
+
raw_query,
|
|
70
|
+
register,
|
|
71
|
+
register_middleware,
|
|
72
|
+
run_method,
|
|
73
|
+
use,
|
|
74
|
+
with_middleware_scope,
|
|
75
|
+
)
|
|
76
|
+
from .connection_routing import (
|
|
77
|
+
DEFAULT_CONNECTION,
|
|
78
|
+
ConfiguredPool,
|
|
79
|
+
ConnectionConfig,
|
|
80
|
+
ConnectionPool,
|
|
81
|
+
ConnectionRegistry,
|
|
82
|
+
ConnectionRegistryBuilder,
|
|
83
|
+
ConnectionSetup,
|
|
84
|
+
PoolConnection,
|
|
85
|
+
RawConnectionPool,
|
|
86
|
+
ReaderWriterPools,
|
|
87
|
+
ResolvedConnectionConfig,
|
|
88
|
+
RoutingConfig,
|
|
89
|
+
WriterStickyClock,
|
|
90
|
+
build_routing_config,
|
|
91
|
+
close_all_pools,
|
|
92
|
+
configured_pool,
|
|
93
|
+
in_writer_scope,
|
|
94
|
+
mysql_pool_factory,
|
|
95
|
+
pg_pool_factory,
|
|
96
|
+
reader_writer_pair,
|
|
97
|
+
resolve_connection_config,
|
|
98
|
+
resolve_pool,
|
|
99
|
+
routed_begin_tx,
|
|
100
|
+
session_reset_statements,
|
|
101
|
+
session_statements,
|
|
102
|
+
single_pool_pair,
|
|
103
|
+
with_writer,
|
|
104
|
+
)
|
|
105
|
+
from .static_bundle import (
|
|
106
|
+
assemble_make_sql,
|
|
107
|
+
compose_make_sql,
|
|
108
|
+
execute_read_graph,
|
|
109
|
+
render_placeholders,
|
|
110
|
+
render_read_primary,
|
|
111
|
+
render_statements,
|
|
112
|
+
)
|
|
113
|
+
from .runtime import (
|
|
114
|
+
ENTITY_ROOT,
|
|
115
|
+
execute_bundle,
|
|
116
|
+
execute_transaction_bundle,
|
|
117
|
+
order_by_nulls,
|
|
118
|
+
)
|
|
119
|
+
from .relation import (
|
|
120
|
+
dedupe_keys,
|
|
121
|
+
distribute_to_parent,
|
|
122
|
+
read_bundle,
|
|
123
|
+
run_relation_op,
|
|
124
|
+
)
|
|
125
|
+
from .leaves import make_handlers
|
|
126
|
+
|
|
127
|
+
__version__ = "2.2.0"
|
|
128
|
+
|
|
129
|
+
__all__ = [
|
|
130
|
+
"__version__",
|
|
131
|
+
# dialect
|
|
132
|
+
"SQLITE",
|
|
133
|
+
"POSTGRES",
|
|
134
|
+
"MYSQL",
|
|
135
|
+
"Dialect",
|
|
136
|
+
"dialect_for",
|
|
137
|
+
"to_dollar_placeholders",
|
|
138
|
+
# driver seam
|
|
139
|
+
"Driver",
|
|
140
|
+
"PreparedStatement",
|
|
141
|
+
"RunInfo",
|
|
142
|
+
"SqliteDriver",
|
|
143
|
+
"PostgresDriver",
|
|
144
|
+
"MysqlDriver",
|
|
145
|
+
"TxConnection",
|
|
146
|
+
# errors
|
|
147
|
+
"SqlFailure",
|
|
148
|
+
"LimitExceededError",
|
|
149
|
+
"check_find_hard_limit",
|
|
150
|
+
"map_sqlite_error",
|
|
151
|
+
# ExecutionContext + central execute/run seam (Phase A / #78)
|
|
152
|
+
"Connection",
|
|
153
|
+
"ExecutionContext",
|
|
154
|
+
"MiddlewareChain",
|
|
155
|
+
"StatementIntent",
|
|
156
|
+
"READ_INTENT",
|
|
157
|
+
"WRITE_INTENT",
|
|
158
|
+
"TxDecision",
|
|
159
|
+
"ambient_in_transaction",
|
|
160
|
+
"ambient_read_only",
|
|
161
|
+
"as_context",
|
|
162
|
+
"check_write_allowed_ambient",
|
|
163
|
+
"commit",
|
|
164
|
+
"context_for_driver",
|
|
165
|
+
"current_context",
|
|
166
|
+
"execute",
|
|
167
|
+
"rollback",
|
|
168
|
+
"run",
|
|
169
|
+
"run_guarded",
|
|
170
|
+
"run_with_pinned_context",
|
|
171
|
+
"transaction",
|
|
172
|
+
"with_transaction",
|
|
173
|
+
"with_transaction_decided",
|
|
174
|
+
# middleware layer (Phase D / #95)
|
|
175
|
+
"LogEntry",
|
|
176
|
+
"Logger",
|
|
177
|
+
"METHOD_KINDS",
|
|
178
|
+
"MethodKind",
|
|
179
|
+
"MiddlewareConfig",
|
|
180
|
+
"MiddlewareDescriptor",
|
|
181
|
+
"MiddlewareHandle",
|
|
182
|
+
"RawResult",
|
|
183
|
+
"Registry",
|
|
184
|
+
"SqlHook",
|
|
185
|
+
"active_sql_middlewares",
|
|
186
|
+
"clear_middlewares",
|
|
187
|
+
"create_middleware",
|
|
188
|
+
"current_registry",
|
|
189
|
+
"raw_execute",
|
|
190
|
+
"raw_query",
|
|
191
|
+
"register",
|
|
192
|
+
"register_middleware",
|
|
193
|
+
"run_method",
|
|
194
|
+
"use",
|
|
195
|
+
"with_middleware_scope",
|
|
196
|
+
# tx-completeness primitives (Phase B / #84)
|
|
197
|
+
"IsolationLevel",
|
|
198
|
+
"TransactionOptions",
|
|
199
|
+
"WriteOutsideTransactionError",
|
|
200
|
+
"WriteInReadOnlyContextError",
|
|
201
|
+
"begin_statements",
|
|
202
|
+
"check_write_allowed",
|
|
203
|
+
"is_connection_error",
|
|
204
|
+
"is_retryable_tx_error",
|
|
205
|
+
"isolation_prelude",
|
|
206
|
+
# connection routing + config (Phase C / #90)
|
|
207
|
+
"DEFAULT_CONNECTION",
|
|
208
|
+
"ConfiguredPool",
|
|
209
|
+
"ConnectionConfig",
|
|
210
|
+
"ConnectionPool",
|
|
211
|
+
"ConnectionRegistry",
|
|
212
|
+
"ConnectionRegistryBuilder",
|
|
213
|
+
"ConnectionSetup",
|
|
214
|
+
"PoolConnection",
|
|
215
|
+
"RawConnectionPool",
|
|
216
|
+
"ReaderWriterPools",
|
|
217
|
+
"ResolvedConnectionConfig",
|
|
218
|
+
"RoutingConfig",
|
|
219
|
+
"WriterStickyClock",
|
|
220
|
+
"build_routing_config",
|
|
221
|
+
"close_all_pools",
|
|
222
|
+
"configured_pool",
|
|
223
|
+
"in_writer_scope",
|
|
224
|
+
"mysql_pool_factory",
|
|
225
|
+
"pg_pool_factory",
|
|
226
|
+
"reader_writer_pair",
|
|
227
|
+
"resolve_connection_config",
|
|
228
|
+
"resolve_pool",
|
|
229
|
+
"routed_begin_tx",
|
|
230
|
+
"session_reset_statements",
|
|
231
|
+
"session_statements",
|
|
232
|
+
"single_pool_pair",
|
|
233
|
+
"with_writer",
|
|
234
|
+
# static makeSQL bundle runtime (the sole read/render path)
|
|
235
|
+
"assemble_make_sql",
|
|
236
|
+
"compose_make_sql",
|
|
237
|
+
"execute_read_graph",
|
|
238
|
+
"render_placeholders",
|
|
239
|
+
"render_read_primary",
|
|
240
|
+
"render_statements",
|
|
241
|
+
# runtime
|
|
242
|
+
"ENTITY_ROOT",
|
|
243
|
+
"execute_bundle",
|
|
244
|
+
"execute_transaction_bundle",
|
|
245
|
+
"order_by_nulls",
|
|
246
|
+
# read-relation batch execution + hydration (#43)
|
|
247
|
+
"dedupe_keys",
|
|
248
|
+
"distribute_to_parent",
|
|
249
|
+
"read_bundle",
|
|
250
|
+
"run_relation_op",
|
|
251
|
+
# op-agnostic leaf transport for the bc-generated native (ir-exec) modules (#141 / epic #123)
|
|
252
|
+
"make_handlers",
|
|
253
|
+
]
|