From a7ec3ad8ffb6eb356d8a73189ebc8906a8151107 Mon Sep 17 00:00:00 2001 From: Yurii Motov Date: Fri, 4 Dec 2026 08:19:05 +0100 Subject: [PATCH 1/8] Fix `invalid-method-override` renamed to `incompatible-method-override` --- sqlmodel/main.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sqlmodel/main.py b/sqlmodel/main.py index 0d4ccd7634..b09fc3f299 100644 --- a/sqlmodel/main.py +++ b/sqlmodel/main.py @@ -562,13 +562,13 @@ class SQLModelMetaclass(ModelMetaclass, DeclarativeMeta): model_fields: ClassVar[dict[str, FieldInfo]] # Replicate SQLAlchemy - def __setattr__(cls, name: str, value: Any) -> None: # ty: ignore[invalid-method-override] + def __setattr__(cls, name: str, value: Any) -> None: # ty: ignore[incompatible-method-override] if is_table_model_class(cls): DeclarativeMeta.__setattr__(cls, name, value) else: super().__setattr__(name, value) - def __delattr__(cls, name: str) -> None: # ty: ignore[invalid-method-override] + def __delattr__(cls, name: str) -> None: # ty: ignore[incompatible-method-override] if is_table_model_class(cls): DeclarativeMeta.__delattr__(cls, name) else: @@ -909,7 +909,7 @@ def __tablename__(cls) -> str: return cls.__name__.lower() @classmethod - def model_validate( # ty: ignore[invalid-method-override] + def model_validate( # ty: ignore[incompatible-method-override] cls: type[_TSQLModel], obj: Any, *, From 1b926cadd8db3978ee340042743e8d644a198967 Mon Sep 17 00:00:00 2001 From: Yurii Motov Date: Fri, 4 Dec 2026 08:19:21 +0100 Subject: [PATCH 2/8] Bump ty to 1.0.0 --- uv.lock | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/uv.lock b/uv.lock index 89d89efcd6..1dc9ba1f62 100644 --- a/uv.lock +++ b/uv.lock @@ -2106,27 +2106,27 @@ wheels = [ [[package]] name = "ty" -version = "0.0.81" -source = { registry = "https://pypi.org/simple" } -sdist = { url = "https://files.pythonhosted.org/packages/61/b7/c9d736f48585f5a711ea47bb97a353d3771834f89481d747ea9687b74fa9/ty-0.0.81.tar.gz", hash = "sha256:ef721aa649bf41d665ba86e1ea726fd3feab6800e2c4887a062a704baf304ca8", size = 7225871, upload-time = "2026-09-15T02:05:29.536Z" } -wheels = [ - { url = "https://files.pythonhosted.org/packages/6c/70/649a5ec8fd6cc9dfa731c905523b19e677ad36dd9dcc4fcadfed8235507f/ty-0.0.81-py3-none-linux_armv6l.whl", hash = "sha256:8e9e3dd6edb1462633ddba2bf337d1c05023a5a13c2f315e445565c7ad43d247", size = 13679646, upload-time = "2026-09-15T02:04:51.436Z" }, - { url = "https://files.pythonhosted.org/packages/b5/d0/3769b760918c3dde1bbaeee87422cd442fc550baadb5c8621e479b363282/ty-0.0.81-py3-none-macosx_10_12_x86_64.whl", hash = "sha256:649c350873e4b3e937d856512ee57b8a345d80079cbead73a5308c2cdafe594c", size = 13211367, upload-time = "2026-09-15T02:04:54.18Z" }, - { url = "https://files.pythonhosted.org/packages/f8/5f/b8fe3ab7eee87bbf1f5ff1b65c55526a3f31a9604630bc9e7d84199bbac5/ty-0.0.81-py3-none-macosx_11_0_arm64.whl", hash = "sha256:480c78706ba78239f901d68cf1ba53e98b84aa51e19b9241daa0fb62fdecd2e2", size = 13084312, upload-time = "2026-09-15T02:04:56.133Z" }, - { url = "https://files.pythonhosted.org/packages/7f/d8/ce22278014f14ae8205d2f9622696d39c623a0c9e80056c258bb89bb8322/ty-0.0.81-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:7cdbfa4b634b1d21542eedc11e424dedcc4871c2128d0d46b55b0089d3220492", size = 13127965, upload-time = "2026-09-15T02:04:58.306Z" }, - { url = "https://files.pythonhosted.org/packages/82/d0/4e75c61f6a241a0804f25117af4f91a5aaa4a48408b57f8d4c34d8a3d91e/ty-0.0.81-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:5f7a34743a21669d4f3d5fda98c36189cb4d9dceee1415a8a42d7426d55995db", size = 13432523, upload-time = "2026-09-15T02:05:00.471Z" }, - { url = "https://files.pythonhosted.org/packages/0b/02/e0b6b783418515c8ba40c13d5e333da9e0576a7a69582fc2b5831bb7d913/ty-0.0.81-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:742eab849947bc10b4c09810d37bd743afe9502e114b7bcfd6389f0ae3f425aa", size = 14211082, upload-time = "2026-09-15T02:05:02.455Z" }, - { url = "https://files.pythonhosted.org/packages/6b/af/85cb68d13ff617f2b213212d674e1266b933f2d051b63a1e5116e8ca0bfc/ty-0.0.81-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:2b4cef395eee7007449aa3fc3fc8dc6bc58fe7a8956d56db078569061741bf52", size = 14692204, upload-time = "2026-09-15T02:05:04.705Z" }, - { url = "https://files.pythonhosted.org/packages/24/c6/791891f3fa8fec91e9ec3e8c9d6774ab903297defe847a3e5d7e047360ad/ty-0.0.81-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:80cf8c34973a1da2ec2a043efcba8f4c0a984d45210957a8ddd2c16f2b8f8e85", size = 14371010, upload-time = "2026-09-15T02:05:06.63Z" }, - { url = "https://files.pythonhosted.org/packages/c7/b2/c9fba5b4ed7f63f26e83432fa2062ca04606b61dce7bbacc1238232af649/ty-0.0.81-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:f37a8f66c444eea29f17adfe0664f42062520773f18031fd4913f28eb56d2966", size = 13758537, upload-time = "2026-09-15T02:05:08.722Z" }, - { url = "https://files.pythonhosted.org/packages/77/e6/09c41e96bbcbe53dd18c9a1a6dbd2e456b0d03b94440a4bd9bab55a4e19a/ty-0.0.81-py3-none-manylinux_2_31_riscv64.whl", hash = "sha256:e8134cc03e84a27f409877b9b62053fd4aaac9c3ce0ce0fdace8b5ed58d78e04", size = 14280789, upload-time = "2026-09-15T02:05:10.719Z" }, - { url = "https://files.pythonhosted.org/packages/5b/d1/87eb8e01fb17602cde5911cbadb9b11141a04f728dbda0a2a00243f337ca/ty-0.0.81-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:fb6f269c5f14a07047e05cbf3d06dd9a64a048050f736afcf744a180a272f034", size = 13169638, upload-time = "2026-09-15T02:05:12.806Z" }, - { url = "https://files.pythonhosted.org/packages/94/3c/137ceb792858f408c48f20a066d12ee76108e5f28a13242720879c024172/ty-0.0.81-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:38355a5e6294ebd3cee616ed581d051963d61b293a1b3351c248747f73a45b74", size = 13449856, upload-time = "2026-09-15T02:05:15.505Z" }, - { url = "https://files.pythonhosted.org/packages/fe/0a/4a9b31fadfc80a2141f3862316eb31944843e01bc1f6533794291cce767e/ty-0.0.81-py3-none-musllinux_1_2_i686.whl", hash = "sha256:59a35e128a9831423aee19db804aa8a1358ee3ce615b3fc0dec20d40bfd0d733", size = 13675303, upload-time = "2026-09-15T02:05:17.537Z" }, - { url = "https://files.pythonhosted.org/packages/e3/16/dbcd2c10ab80b015a227110a4ec75314468b6720d800261098521df4eee9/ty-0.0.81-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:f0f4219fbc068ea3414fa804c6bd57ef4229a11884ab9ca71cd8308072520aad", size = 14050298, upload-time = "2026-09-15T02:05:20.424Z" }, - { url = "https://files.pythonhosted.org/packages/95/ba/a70ced0c0c078ff09a3a80224d045c4267d07811dbaf125c749af5f72606/ty-0.0.81-py3-none-win32.whl", hash = "sha256:82ff952e64ba4c4da1c0c89723e326c768ae4f9ff20624dee04a51c3f4e4b96c", size = 12866650, upload-time = "2026-09-15T02:05:22.824Z" }, - { url = "https://files.pythonhosted.org/packages/3f/51/4b79453df93dfb9edecb1bd6cb04e772277d8c7260693165358a033b6ed1/ty-0.0.81-py3-none-win_amd64.whl", hash = "sha256:ef82788744da0b7f2a598e4e9776f9c5998df4eef7e2750ae3a5537e7c734b69", size = 13572976, upload-time = "2026-09-15T02:05:24.907Z" }, - { url = "https://files.pythonhosted.org/packages/0a/56/09594d55a0c49543eeac149c0dbc80b9b04409cc26ca48f1c1a9595c0916/ty-0.0.81-py3-none-win_arm64.whl", hash = "sha256:bdb1563990c5d3abfe5a09e7512733f302773ede6a5d3e4e5c6ad46393d8df4d", size = 13364408, upload-time = "2026-09-15T02:05:27.247Z" }, +version = "1.0.0" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/e6/e9/d4d4e729d3a30ed05d6736dd64496ed73a1bbac0fef2cc33b6a469fbfdb3/ty-1.0.0.tar.gz", hash = "sha256:f44c2c8febc10a3ef0a6afddf694ded0d7a6ce07f5a8f586ba6989cfba9cfc40", size = 8486013, upload-time = "2026-12-01T16:47:31.676Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/5a/ce/0e2254be3a541b88d1a272e2781fac8e51dabc2c7b03df653555f8b7c8cc/ty-1.0.0-py3-none-linux_armv6l.whl", hash = "sha256:85d054bb73d2231e7610319fc43f6298a1ff2c90f5611212091e59a1e51c6a82", size = 15576631, upload-time = "2026-12-01T16:46:51.033Z" }, + { url = "https://files.pythonhosted.org/packages/51/21/71bceb9dc5e42035e2ba107b8e2b2e8b6f888c712900b9485235b864b5f7/ty-1.0.0-py3-none-macosx_10_12_x86_64.whl", hash = "sha256:9dc24a9659f6a60f87f902000f840706db2fbce169152e77947314f2d22229ba", size = 15126686, upload-time = "2026-12-01T16:46:53.314Z" }, + { url = "https://files.pythonhosted.org/packages/8b/31/ad9ea55f8d274783745ace12f15a0bcf67860e4e27b30af4542245791751/ty-1.0.0-py3-none-macosx_11_0_arm64.whl", hash = "sha256:53a529fd694b58430d90c446015800a22da2b082b1ac8b4c9b11bfd789137155", size = 14727282, upload-time = "2026-12-01T16:46:55.919Z" }, + { url = "https://files.pythonhosted.org/packages/5a/26/f857b930b2a345d82976881b9b8d79a86a337c32682eb8af16933febc8dd/ty-1.0.0-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:6dbd54b073dfbc3366ba4fbee6f3c755b8f1e03dd3032611510d0da5c069f441", size = 15676104, upload-time = "2026-12-01T16:46:58.397Z" }, + { url = "https://files.pythonhosted.org/packages/62/15/9d37c4a299bd7ce13e347d57d177095e93870080352d7702ab3f630bbf5c/ty-1.0.0-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:b17cfe36c3a447bf8ccee87f20e03e1a2fe90bb67165fb5f05408de428e1e6d6", size = 15300998, upload-time = "2026-12-01T16:47:00.65Z" }, + { url = "https://files.pythonhosted.org/packages/2a/60/42b64082a6bb0a48e04dd138f3ac31009600e0ac185ea7b7bfea6305c620/ty-1.0.0-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:156e9e7a684518e96faab0495102d00cb1543c01b13bd1aab80b7db822bc3463", size = 16333807, upload-time = "2026-12-01T16:47:03.574Z" }, + { url = "https://files.pythonhosted.org/packages/3e/38/e7fbb7724689f5a0c9aa1ff4781b6b789d471439131f46c90eaeef99f5bd/ty-1.0.0-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:4398eccb49be132344412149fa65ca3b1033a3902ce6ecfd33590f9411b34483", size = 16761409, upload-time = "2026-12-01T16:47:06.111Z" }, + { url = "https://files.pythonhosted.org/packages/fd/29/cbc7a4a93f70cd015bb3efc6f70bbd898b19e5fc618b81d7fc0aa9aec86e/ty-1.0.0-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:81f10ebd1e2790d9c52b7ae98a6b43667a7e48987c940774fb9d20daecab9ba4", size = 16592442, upload-time = "2026-12-01T16:47:08.597Z" }, + { url = "https://files.pythonhosted.org/packages/e7/89/5d7c69266d9e4be567c60afdab8ce67ecdf2f72a5fc20facf6894a45ea5c/ty-1.0.0-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:b6f6de937733b9f53d44d1bf38fd7c8c37eacb08df39c4ac74104d1369f3508e", size = 18056945, upload-time = "2026-12-01T16:47:11.228Z" }, + { url = "https://files.pythonhosted.org/packages/f3/ab/df18c5a9c58bae6652187bafdd28caacdd4197d910bd53e204820cf7230f/ty-1.0.0-py3-none-manylinux_2_31_riscv64.whl", hash = "sha256:ab3cc13d8b44b006740a2b726818b530db1a07adb26965d598c456fb395c1b39", size = 16194867, upload-time = "2026-12-01T16:47:13.475Z" }, + { url = "https://files.pythonhosted.org/packages/95/63/cda9af06c60c3e4ce761e3e6d9856a7fbaa8a72de8a7a26bb6f4aa65e807/ty-1.0.0-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:eb1f2ee59e06e99e7afc7d4b55b3c0f0374b961125a4abb2b4b537948a362164", size = 14986686, upload-time = "2026-12-01T16:47:15.569Z" }, + { url = "https://files.pythonhosted.org/packages/01/a3/d607dc4fea80ff8b9b28d253322d8c8e7a24fac1ab609d53fe4d2373c07b/ty-1.0.0-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:4465087699fff93365de7456c354f7ca888d3ffa866c0e9c462459cc10e49b9a", size = 15312128, upload-time = "2026-12-01T16:47:17.949Z" }, + { url = "https://files.pythonhosted.org/packages/c5/0d/16d2b397b15ce81d583a5749381fb0442b8ea5ba6b6be9f8923d5808d3a7/ty-1.0.0-py3-none-musllinux_1_2_i686.whl", hash = "sha256:e665d75055bd29c7b927079df0f1cab7467c8e35f6f46dbf5b7ef0f2bf795bf8", size = 15691625, upload-time = "2026-12-01T16:47:20.251Z" }, + { url = "https://files.pythonhosted.org/packages/b3/b0/eb5a879ba3ede632975b790a15824b32b37b178e943eb74629a7fe9360e1/ty-1.0.0-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:142d4246148aa81993b126778176e95f2ab2d5c2a18e5e39ef85c46f7cdf4187", size = 16015617, upload-time = "2026-12-01T16:47:22.707Z" }, + { url = "https://files.pythonhosted.org/packages/0a/c1/9125ccaa9fdb2bf01ed2049021cb38c3719f34975f50ef30b7e20fa12dec/ty-1.0.0-py3-none-win32.whl", hash = "sha256:12810598e01b77bfc450c46b0d80d6163743911265b15214c3367abdf4d42707", size = 14534799, upload-time = "2026-12-01T16:47:24.771Z" }, + { url = "https://files.pythonhosted.org/packages/68/b0/ecb8aa569131c81e9e0df99908cf578de47015550f1da377979f412940b0/ty-1.0.0-py3-none-win_amd64.whl", hash = "sha256:3766baad89e2de310bbcf641b1af6cd018c037ecddcfaf0cc65652ee48f12642", size = 15389185, upload-time = "2026-12-01T16:47:26.951Z" }, + { url = "https://files.pythonhosted.org/packages/ee/4c/bd2c62051747eaeec24cc9183dfd8f1e314c225bd4a4f56f4d79885974e1/ty-1.0.0-py3-none-win_arm64.whl", hash = "sha256:03a67077356e8eb9ecc2bd02d7ecd5782b45d00274d88c1cd707c6d6d7f61128", size = 14636001, upload-time = "2026-12-01T16:47:29.196Z" }, ] [[package]] From 1cfd59debb7fe2a09f6d9354a5aa3025cff26003 Mon Sep 17 00:00:00 2001 From: Yurii Motov Date: Fri, 4 Dec 2026 08:20:40 +0100 Subject: [PATCH 3/8] Fix `invalid-key` renamed to `invalid-typed-dict-key` --- sqlmodel/main.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sqlmodel/main.py b/sqlmodel/main.py index b09fc3f299..21e82d9cd0 100644 --- a/sqlmodel/main.py +++ b/sqlmodel/main.py @@ -646,10 +646,10 @@ def get_config(name: str) -> Any: # This could be done by reading new_cls.model_config['table'] in FastAPI, but # that's very specific about SQLModel, so let's have another config that # other future tools based on Pydantic can use. - new_cls.model_config["read_from_attributes"] = True # ty: ignore[invalid-key] + new_cls.model_config["read_from_attributes"] = True # ty: ignore[invalid-typed-dict-key] # For compatibility with older versions # TODO: remove this in the future - new_cls.model_config["read_with_orm_mode"] = True # ty: ignore[invalid-key] + new_cls.model_config["read_with_orm_mode"] = True # ty: ignore[invalid-typed-dict-key] config_registry = get_config("registry") if config_registry is not Undefined: From 12ed157ab8a97c1b448e871b477938c6cee68b6f Mon Sep 17 00:00:00 2001 From: Yurii Motov Date: Fri, 4 Dec 2026 09:02:14 +0100 Subject: [PATCH 4/8] Fix rule name in ignore comment --- sqlmodel/main.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sqlmodel/main.py b/sqlmodel/main.py index 21e82d9cd0..9b759a596e 100644 --- a/sqlmodel/main.py +++ b/sqlmodel/main.py @@ -562,13 +562,13 @@ class SQLModelMetaclass(ModelMetaclass, DeclarativeMeta): model_fields: ClassVar[dict[str, FieldInfo]] # Replicate SQLAlchemy - def __setattr__(cls, name: str, value: Any) -> None: # ty: ignore[incompatible-method-override] + def __setattr__(cls, name: str, value: Any) -> None: # ty: ignore[lost-keyword-for-regular-parameter] if is_table_model_class(cls): DeclarativeMeta.__setattr__(cls, name, value) else: super().__setattr__(name, value) - def __delattr__(cls, name: str) -> None: # ty: ignore[incompatible-method-override] + def __delattr__(cls, name: str) -> None: # ty: ignore[lost-keyword-for-regular-parameter] if is_table_model_class(cls): DeclarativeMeta.__delattr__(cls, name) else: From 385a97845851764c05b0b9b232b72b5e56622753 Mon Sep 17 00:00:00 2001 From: Yurii Motov Date: Fri, 4 Dec 2026 12:50:35 +0100 Subject: [PATCH 5/8] Fix Unknown keys "registry" and "table" for TypedDict `ConfigDict` --- sqlmodel/main.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/sqlmodel/main.py b/sqlmodel/main.py index 9b759a596e..515bd180a6 100644 --- a/sqlmodel/main.py +++ b/sqlmodel/main.py @@ -624,9 +624,10 @@ def __new__( **pydantic_annotations, **new_cls.__annotations__, } + new_cls_model_config = cast(SQLModelConfig, new_cls.model_config) def get_config(name: str) -> Any: - config_class_value = new_cls.model_config.get(name, Undefined) + config_class_value = new_cls_model_config.get(name, Undefined) if config_class_value is not Undefined: return config_class_value kwarg_value = kwargs.get(name, Undefined) @@ -637,7 +638,7 @@ def get_config(name: str) -> Any: config_table = get_config("table") if config_table is True: # If it was passed by kwargs, ensure it's also set in config - new_cls.model_config["table"] = config_table + new_cls_model_config["table"] = config_table for k, v in get_model_fields(new_cls).items(): col = get_column_from_field(v) setattr(new_cls, k, col) @@ -646,16 +647,16 @@ def get_config(name: str) -> Any: # This could be done by reading new_cls.model_config['table'] in FastAPI, but # that's very specific about SQLModel, so let's have another config that # other future tools based on Pydantic can use. - new_cls.model_config["read_from_attributes"] = True # ty: ignore[invalid-typed-dict-key] + new_cls_model_config["read_from_attributes"] = True # ty: ignore[invalid-typed-dict-key] # For compatibility with older versions # TODO: remove this in the future - new_cls.model_config["read_with_orm_mode"] = True # ty: ignore[invalid-typed-dict-key] + new_cls_model_config["read_with_orm_mode"] = True # ty: ignore[invalid-typed-dict-key] config_registry = get_config("registry") if config_registry is not Undefined: config_registry = cast(registry, config_registry) # If it was passed by kwargs, ensure it's also set in config - new_cls.model_config["registry"] = config_table + new_cls_model_config["registry"] = config_table setattr(new_cls, "_sa_registry", config_registry) # noqa: B010 setattr(new_cls, "metadata", config_registry.metadata) # noqa: B010 setattr(new_cls, "__abstract__", True) # noqa: B010 From 47d225ecff9729c979bb48d6a4c78ef14f28ca36 Mon Sep 17 00:00:00 2001 From: Yurii Motov Date: Fri, 4 Dec 2026 13:01:13 +0100 Subject: [PATCH 6/8] Fix Variable `ann` cannot be used as a type --- sqlmodel/main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sqlmodel/main.py b/sqlmodel/main.py index 515bd180a6..53730cc4a4 100644 --- a/sqlmodel/main.py +++ b/sqlmodel/main.py @@ -687,7 +687,7 @@ def __init__( # Plain forward references, for models not yet defined, are not # handled well by SQLAlchemy without Mapped, so, wrap the # annotations in Mapped here - cls.__annotations__[rel_name] = Mapped[ann] + cls.__annotations__[rel_name] = Mapped[ann] # ty: ignore[invalid-type-form] relationship_to = get_relationship_to( name=rel_name, rel_info=rel_info, annotation=ann ) From 7a44da6bc9af2c983201eba71384178d3b898346 Mon Sep 17 00:00:00 2001 From: Yurii Motov Date: Fri, 4 Dec 2026 13:18:10 +0100 Subject: [PATCH 7/8] Fix Argument to function `issubclass` is incorrect --- sqlmodel/main.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sqlmodel/main.py b/sqlmodel/main.py index 53730cc4a4..242e8140d1 100644 --- a/sqlmodel/main.py +++ b/sqlmodel/main.py @@ -743,7 +743,7 @@ def get_sqlalchemy_type(field: Any) -> Any: ipaddress.IPv6Address, ipaddress.IPv6Network, Path, - EmailStr, + cast(type, EmailStr), ), ): max_length = getattr(metadata, "max_length", None) @@ -756,7 +756,9 @@ def get_sqlalchemy_type(field: Any) -> Any: return Boolean if issubclass(type_, int): return Integer - if issubclass(type_, (datetime, AwareDatetime, NaiveDatetime)): + if issubclass( + type_, (datetime, cast(type, AwareDatetime), cast(type, NaiveDatetime)) + ): if issubclass(type_, cast(type, NaiveDatetime)): return DateTime(timezone=False) return UTCDateTime() From ea42e4ab5e8166616a57c644900acd5d76989f74 Mon Sep 17 00:00:00 2001 From: Yurii Motov Date: Fri, 4 Dec 2026 13:51:14 +0100 Subject: [PATCH 8/8] Fix Invalid override of attribute ... --- sqlmodel/ext/asyncio/session.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sqlmodel/ext/asyncio/session.py b/sqlmodel/ext/asyncio/session.py index cdc890f626..1271bedc01 100644 --- a/sqlmodel/ext/asyncio/session.py +++ b/sqlmodel/ext/asyncio/session.py @@ -29,8 +29,8 @@ class AsyncSession(_AsyncSession): - sync_session_class: type[Session] = Session - sync_session: Session + sync_session_class: type[Session] = Session # ty: ignore[incompatible-mutable-override] + sync_session: Session # ty: ignore[incompatible-mutable-override] @overload async def exec(