sqlmodel-ext 0.5.2__py3-none-any.whl → 0.5.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.
- sqlmodel_ext/__init__.py +1 -1
- sqlmodel_ext/mixins/cached_table.py +18 -3
- {sqlmodel_ext-0.5.2.dist-info → sqlmodel_ext-0.5.3.dist-info}/METADATA +2 -2
- {sqlmodel_ext-0.5.2.dist-info → sqlmodel_ext-0.5.3.dist-info}/RECORD +7 -7
- {sqlmodel_ext-0.5.2.dist-info → sqlmodel_ext-0.5.3.dist-info}/WHEEL +0 -0
- {sqlmodel_ext-0.5.2.dist-info → sqlmodel_ext-0.5.3.dist-info}/entry_points.txt +0 -0
- {sqlmodel_ext-0.5.2.dist-info → sqlmodel_ext-0.5.3.dist-info}/licenses/LICENSE +0 -0
sqlmodel_ext/__init__.py
CHANGED
|
@@ -20,7 +20,7 @@ Quick start::
|
|
|
20
20
|
user = await user.save(session)
|
|
21
21
|
users = await User.get(session, fetch_mode="all")
|
|
22
22
|
"""
|
|
23
|
-
__version__ = "0.5.
|
|
23
|
+
__version__ = "0.5.3"
|
|
24
24
|
|
|
25
25
|
# Every re-export below uses the redundant ``X as X`` form: the package ships
|
|
26
26
|
# ``py.typed``, and type checkers treat a plain ``from m import X`` in a typed
|
|
@@ -265,7 +265,7 @@ _FORBIDDEN_DIRECT_CALLS: frozenset[str] = frozenset({
|
|
|
265
265
|
|
|
266
266
|
|
|
267
267
|
def _on_outermost_transaction_end(session: _SyncSession, transaction: SessionTransaction) -> None:
|
|
268
|
-
"""Clear the
|
|
268
|
+
"""Clear the state that feeds the "uncommitted writes" check when the outermost transaction ends.
|
|
269
269
|
|
|
270
270
|
``transaction.parent is None`` is the *common exit* of commit / rollback /
|
|
271
271
|
``close()`` / ``reset()`` / ``invalidate()`` -- all of them dispatch this
|
|
@@ -276,12 +276,26 @@ def _on_outermost_transaction_end(session: _SyncSession, transaction: SessionTra
|
|
|
276
276
|
cleanup always misses an entry point. Nested savepoints and the
|
|
277
277
|
SUBTRANSACTION of a flush (``parent`` set) are ignored.
|
|
278
278
|
|
|
279
|
+
``_SESSION_PENDING_CACHE_KEY`` is cleared here as well. Besides being the
|
|
280
|
+
list of pending invalidations, it is one of the three sources of
|
|
281
|
+
``_tables_with_uncommitted_writes``: if it survives an ``invalidate()``,
|
|
282
|
+
every later ``get()`` on those tables skips the cache for as long as the
|
|
283
|
+
session is reused. On commit and on the outermost rollback,
|
|
284
|
+
``after_commit`` / ``after_rollback`` have already popped it, so this is a
|
|
285
|
+
no-op there; ``invalidate()`` fires only this event.
|
|
286
|
+
|
|
287
|
+
Do **not** clear ``_SESSION_COMMITTED_PENDING_KEY`` here: the enhanced
|
|
288
|
+
``commit()`` reads it after ``super().commit()`` returns, and this event
|
|
289
|
+
fires inside ``super().commit()``, right after ``after_commit``. Clearing
|
|
290
|
+
it here would drop the synchronous invalidation of every enhanced commit.
|
|
291
|
+
|
|
279
292
|
Registered at import time (not by ``_register_session_commit_hook``):
|
|
280
293
|
``register_raw_dml_write`` fills the set for every session, cached models
|
|
281
294
|
or not, so its lifetime must not depend on cache configuration.
|
|
282
295
|
"""
|
|
283
296
|
if transaction.parent is None:
|
|
284
297
|
session.info.pop(_SESSION_FLUSHED_TABLES, None)
|
|
298
|
+
session.info.pop(_SESSION_PENDING_CACHE_KEY, None)
|
|
285
299
|
|
|
286
300
|
|
|
287
301
|
event.listen(_SyncSession, "after_transaction_end", _on_outermost_transaction_end)
|
|
@@ -2590,8 +2604,9 @@ class CachedTableBaseMixin(TableBaseMixin):
|
|
|
2590
2604
|
|
|
2591
2605
|
This is **not** the common exit of transaction termination:
|
|
2592
2606
|
``close()`` / ``reset()`` do not dispatch ``after_rollback``, and the
|
|
2593
|
-
async ``invalidate()`` bypasses them entirely.
|
|
2594
|
-
|
|
2607
|
+
async ``invalidate()`` bypasses them entirely. State that feeds the
|
|
2608
|
+
uncommitted-writes check (``_SESSION_FLUSHED_TABLES`` and
|
|
2609
|
+
``_SESSION_PENDING_CACHE_KEY``) is therefore cleared in the
|
|
2595
2610
|
always-on ``_on_outermost_transaction_end`` listener -- do not
|
|
2596
2611
|
add more keys here. The invalidation-tracking keys cleared here are
|
|
2597
2612
|
normally consumed by ``after_commit`` / cleared by ``after_rollback``
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: sqlmodel-ext
|
|
3
|
-
Version: 0.5.
|
|
3
|
+
Version: 0.5.3
|
|
4
4
|
Summary: Extended SQLModel infrastructure: smart metaclass, async CRUD mixins, polymorphic inheritance, optimistic locking, relation preloading, and reusable field types.
|
|
5
5
|
Project-URL: Homepage, https://github.com/Foxerine/sqlmodel-ext
|
|
6
6
|
Project-URL: Repository, https://github.com/Foxerine/sqlmodel-ext
|
|
@@ -23,7 +23,7 @@ Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
|
23
23
|
Classifier: Typing :: Typed
|
|
24
24
|
Requires-Python: >=3.12
|
|
25
25
|
Requires-Dist: pydantic>=2.12
|
|
26
|
-
Requires-Dist: sqlalchemy>=2.0
|
|
26
|
+
Requires-Dist: sqlalchemy[asyncio]>=2.0
|
|
27
27
|
Requires-Dist: sqlmodel>=0.0.32
|
|
28
28
|
Requires-Dist: typing-extensions>=4.14.1
|
|
29
29
|
Provides-Extra: alembic
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
sqlmodel_ext/__init__.py,sha256=
|
|
1
|
+
sqlmodel_ext/__init__.py,sha256=4bSRxdEXXrh_D-E4aa-ZnZ-SuM_BI28Xvma3rMWqyVo,9632
|
|
2
2
|
sqlmodel_ext/_compat.py,sha256=KMLFLQE88J605lSg9bYOUusFjrl46jZKI5VW8C_mNbI,12392
|
|
3
3
|
sqlmodel_ext/_exceptions.py,sha256=CgowpnaxrbQ0EVOfoEJTSrWcJww5AsYMq2AhqzjLTkA,418
|
|
4
4
|
sqlmodel_ext/_sa_type.py,sha256=ZV6Ag_QoyNrGnlf0SLekIpi7Dww07euiU5K4Q9mCbgc,5382
|
|
@@ -31,7 +31,7 @@ sqlmodel_ext/field_types/mixins/__init__.py,sha256=g7Oe_c7IB7nnMopTSE8RohRGMwyNW
|
|
|
31
31
|
sqlmodel_ext/field_types/mixins/module_name_mixin.py,sha256=ulfbdn3BMYrifDTGYzaIMIbA_PpfPVK_953rT3nR488,1117
|
|
32
32
|
sqlmodel_ext/mixins/__init__.py,sha256=EFmPHwLec0dywYsdoz4UOEQpVg0-cjfv701-FCxAh6w,3234
|
|
33
33
|
sqlmodel_ext/mixins/_uuid.py,sha256=fK3EPyrHubhcVqQGtrOx4-k8xtjiPtIPIHvH48s59sQ,2573
|
|
34
|
-
sqlmodel_ext/mixins/cached_table.py,sha256=
|
|
34
|
+
sqlmodel_ext/mixins/cached_table.py,sha256=oJpoMLQlMUVLwH4B8mYg_L6h24VnmpP1RlsbCF1wYco,137493
|
|
35
35
|
sqlmodel_ext/mixins/constants.py,sha256=HisL4pzM8rPRkBC_Pxe3yyNIW2rPeQTFF0dEYawOj0w,577
|
|
36
36
|
sqlmodel_ext/mixins/exceptions.py,sha256=_mde4PwU3PJcaVUfobu8V4FT3alz2UYAgErWa31oo3Q,3969
|
|
37
37
|
sqlmodel_ext/mixins/info_response.py,sha256=Z8akOpN9wlhiq5_MbzEjwGpGDQ99jYvGQt9sItF43ek,1319
|
|
@@ -43,8 +43,8 @@ sqlmodel_ext/mixins/relation_preload.py,sha256=hjIMTn1CitUQ27lkSC15CTsMdXdF5bF4q
|
|
|
43
43
|
sqlmodel_ext/mixins/resource_quota.py,sha256=n9apvZsC4LfbfVjVp9I4q4s2_yBNlSaCYdo12DelQ2A,13860
|
|
44
44
|
sqlmodel_ext/mixins/table.py,sha256=tFXc2ygoX4jdeTR1tRCCtQ7ioF2DQZQxLMfJ1j1Qc30,99825
|
|
45
45
|
sqlmodel_ext/mixins/trgm_searchable.py,sha256=UbxGCYrhotJc5P0HC5igd-_OPY6cc0Gr8QNnMXYl4Qg,11091
|
|
46
|
-
sqlmodel_ext-0.5.
|
|
47
|
-
sqlmodel_ext-0.5.
|
|
48
|
-
sqlmodel_ext-0.5.
|
|
49
|
-
sqlmodel_ext-0.5.
|
|
50
|
-
sqlmodel_ext-0.5.
|
|
46
|
+
sqlmodel_ext-0.5.3.dist-info/METADATA,sha256=9AIKoMmFZJIOhrpHp7db0B6PzLVk5rZ0T3TBy-LGfd4,82127
|
|
47
|
+
sqlmodel_ext-0.5.3.dist-info/WHEEL,sha256=W3fkpkm7-wf9vBI5Z-7s0eWkeM-spu78I8Neb98DeEg,87
|
|
48
|
+
sqlmodel_ext-0.5.3.dist-info/entry_points.txt,sha256=nQMADgM0kg5c7Nt3ynaStu5Zzkq1SNhNrtl286JjbrA,79
|
|
49
|
+
sqlmodel_ext-0.5.3.dist-info/licenses/LICENSE,sha256=8ek0ENxpcXcIhCC7MXetxiYLKflHqz2JbA-nwDqTsyI,1088
|
|
50
|
+
sqlmodel_ext-0.5.3.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|