sqlmodel-ext 0.4.1__py3-none-any.whl → 0.4.2__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 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.4.1"
23
+ __version__ = "0.4.2"
24
24
 
25
25
  # Base
26
26
  from sqlmodel_ext.base import SQLModelBase, ExtraIgnoreModelBase, CustomTableArg
sqlmodel_ext/base.py CHANGED
@@ -975,6 +975,14 @@ class __DeclarativeMeta(SQLModelMetaclass):
975
975
  # FieldInfoMetadata channel — plain setattr is dropped
976
976
  # before SQLModel's column build (see _durably_set_sa_type).
977
977
  _durably_set_sa_type(field_value, sa_type)
978
+ else:
979
+ # Bare default value (e.g. ``fpath: FilePathType = Path("a.txt")``):
980
+ # the assignment is neither Undefined nor a FieldInfo. Wrap it in a
981
+ # Field so the extracted sa_type reaches the column builder while the
982
+ # default is preserved — without this branch the column silently
983
+ # falls back to the base-type inference (AutoString for Path),
984
+ # dropping the type's result_processor.
985
+ attrs[field_name] = Field(default=field_value, sa_type=sa_type)
978
986
 
979
987
  # 5. Save SQLModel FieldInfo from Annotated fields before super().__new__(),
980
988
  # because Pydantic rebuilds model_fields with plain FieldInfo that lacks
@@ -17,7 +17,11 @@ class _PathAsSQLString(TypeDecorator):
17
17
 
18
18
  class _BasePathHandler(ABC):
19
19
  """(Internal) Base class for single-value type handlers like Path."""
20
- sa_type: TypeDecorator = _PathAsSQLString
20
+ # Must be an *instance*, not the class: the metaclass extracts this value
21
+ # from the core-schema metadata and hands it straight to the column
22
+ # builder, which expects a TypeEngine instance (a bare class silently
23
+ # falls back to AutoString, dropping the Path<->str result_processor).
24
+ sa_type: TypeDecorator = _PathAsSQLString()
21
25
 
22
26
  @classmethod
23
27
  @abstractmethod
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: sqlmodel-ext
3
- Version: 0.4.1
3
+ Version: 0.4.2
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
@@ -30,8 +30,14 @@ Requires-Dist: orjson>=3.0; extra == 'cache'
30
30
  Requires-Dist: redis>=5.0; extra == 'cache'
31
31
  Provides-Extra: dev
32
32
  Requires-Dist: aiosqlite>=0.20; extra == 'dev'
33
+ Requires-Dist: fakeredis>=2.20; extra == 'dev'
34
+ Requires-Dist: fastapi>=0.100.0; extra == 'dev'
35
+ Requires-Dist: numpy>=1.24; extra == 'dev'
36
+ Requires-Dist: orjson>=3.0; extra == 'dev'
37
+ Requires-Dist: pgvector>=0.3; extra == 'dev'
33
38
  Requires-Dist: pytest-asyncio>=0.24; extra == 'dev'
34
39
  Requires-Dist: pytest>=8.0; extra == 'dev'
40
+ Requires-Dist: redis>=5.0; extra == 'dev'
35
41
  Requires-Dist: ruff>=0.4; extra == 'dev'
36
42
  Provides-Extra: fastapi
37
43
  Requires-Dist: fastapi>=0.100.0; extra == 'fastapi'
@@ -1,9 +1,9 @@
1
- sqlmodel_ext/__init__.py,sha256=xG-l39gVbrxx3WH7tH1MTKrQKBnpQ10_bd5QOB0NTFI,3755
1
+ sqlmodel_ext/__init__.py,sha256=vfES2vYjiQ-pNQ6vLkH8DMbi5jG8NX5tJQCr4z8WssU,3755
2
2
  sqlmodel_ext/_compat.py,sha256=zia-2vSQqmzk6_4Y404IKzcip5n4fe7PrRAYntlY-Zg,12186
3
3
  sqlmodel_ext/_exceptions.py,sha256=2mC_BVvcreaFutR4UxIra238o1sr4zWv8vctBI6CL2o,413
4
4
  sqlmodel_ext/_sa_type.py,sha256=zDwXBR0O7dne3Y6j8V8CaMtfqZqcpvsPucZUxGh8dAk,4866
5
5
  sqlmodel_ext/_utils.py,sha256=cFrlQp1Uq-4ZAdvi_u79UbEI0IHZaAm5VkXadCXrBmI,174
6
- sqlmodel_ext/base.py,sha256=0m6XkHsZBqLr9d2kpCMStZSDpHxua-UiBtRiL8R4dDk,72263
6
+ sqlmodel_ext/base.py,sha256=p0P3NR1OPYfY-UsJsor1bm4Hudt2WAQZRNpgfgY11nk,72874
7
7
  sqlmodel_ext/pagination.py,sha256=1JOzt51KvIZTyjgYsQTP0v7KDytIkQKlYN4vGkq9RH8,4611
8
8
  sqlmodel_ext/relation_load_checker.py,sha256=1W2vSdk_PVTqBRRcSyIffw-ECysJRfg1bJYVTmx9Wxs,172457
9
9
  sqlmodel_ext/session.py,sha256=LNt9zZn5KUH8BA9evulKrh7233VYDtj9mn4j_uPkHjw,5570
@@ -12,7 +12,7 @@ sqlmodel_ext/field_types/_ssrf.py,sha256=QdrtwWMFN6xZkllyHGwvJ0nwL3rSBn2FkEoxv3L
12
12
  sqlmodel_ext/field_types/ip_address.py,sha256=OeyOAVgDV7aGk56z0LUqgYCinthYYusmZSCR1BLkET4,1589
13
13
  sqlmodel_ext/field_types/url.py,sha256=1iAdu3A9uyMR3XJMs0b3NJ2_VeBAEAfja-_xbdjph5I,5209
14
14
  sqlmodel_ext/field_types/_internal/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
15
- sqlmodel_ext/field_types/_internal/path.py,sha256=bJhrGnidXbEFQyJBoMIKHo2p-a2T805BV4mMSZ8vmDE,2070
15
+ sqlmodel_ext/field_types/_internal/path.py,sha256=HNbW0oXjZK654XSU-dckAHhDmTT4Vz4x89iRSdwSbqs,2375
16
16
  sqlmodel_ext/field_types/dialects/__init__.py,sha256=ENJXbWbIZaU8eXNxAG2rjH_w7oQpb1f790ugCZsm1ro,267
17
17
  sqlmodel_ext/field_types/dialects/postgresql/__init__.py,sha256=3hvtu9Z0E4BfZ4VwYWbmDYDV_-NKoQJYA8mUWynCLCU,1291
18
18
  sqlmodel_ext/field_types/dialects/postgresql/array.py,sha256=bj1wMjVE1Hsj_rxfFXa57U3FV_3a8vq1y-0-bmqdGRE,8913
@@ -28,7 +28,7 @@ sqlmodel_ext/mixins/optimistic_lock.py,sha256=XVjO6NgKYfpcsGlH1Yj8Ou9NkpCsqVN9AZ
28
28
  sqlmodel_ext/mixins/polymorphic.py,sha256=tGg_V98hQu2L0WcI8oOr7hzO9MZ7QfqNVFaACuaD1Dc,33211
29
29
  sqlmodel_ext/mixins/relation_preload.py,sha256=SD9Nnc8zIbUqWqI85gr4XRpbPsmJwXQd7JPHj_EVrLs,15967
30
30
  sqlmodel_ext/mixins/table.py,sha256=JbEhCkbhbYC0TyCSSfSz_3FFtcbvg2nNmh7F-Rtzg-E,60817
31
- sqlmodel_ext-0.4.1.dist-info/METADATA,sha256=XI34AHmMUOEQG8ib-MYblozJrvyqNHRJRD4bhvYSu0I,53102
32
- sqlmodel_ext-0.4.1.dist-info/WHEEL,sha256=mffPy8wBnZQn2VnJUU5jE99KsxaSfiyMHV9Yt0aLVxs,87
33
- sqlmodel_ext-0.4.1.dist-info/licenses/LICENSE,sha256=8ek0ENxpcXcIhCC7MXetxiYLKflHqz2JbA-nwDqTsyI,1088
34
- sqlmodel_ext-0.4.1.dist-info/RECORD,,
31
+ sqlmodel_ext-0.4.2.dist-info/METADATA,sha256=5VlaFg4iU1PI5psQjI2XcmiREVJPsIyjvkQ5f2MJLZs,53370
32
+ sqlmodel_ext-0.4.2.dist-info/WHEEL,sha256=mffPy8wBnZQn2VnJUU5jE99KsxaSfiyMHV9Yt0aLVxs,87
33
+ sqlmodel_ext-0.4.2.dist-info/licenses/LICENSE,sha256=8ek0ENxpcXcIhCC7MXetxiYLKflHqz2JbA-nwDqTsyI,1088
34
+ sqlmodel_ext-0.4.2.dist-info/RECORD,,