Skip to content

Commit 06deba8

Browse files
committed
Remove 3.6 support
1 parent 30965e1 commit 06deba8

File tree

2 files changed

+9
-33
lines changed

2 files changed

+9
-33
lines changed

pyproject.toml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,6 @@ fastapi = "^0.68.1"
4949
requests = "^2.26.0"
5050
autoflake = "^1.4"
5151
isort = "^5.9.3"
52-
async_generator = {version = "*", python = "~3.6"}
53-
async-exit-stack = {version = "*", python = "~3.6"}
5452

5553
[build-system]
5654
requires = ["poetry-core"]

sqlmodel/sql/expression.py.jinja2

Lines changed: 9 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -22,37 +22,15 @@ from sqlalchemy.sql.expression import Select as _Select
2222

2323
_TSelect = TypeVar("_TSelect")
2424

25-
# Workaround Generics incompatibility in Python 3.6
26-
# Ref: https://github.com/python/typing/issues/449#issuecomment-316061322
27-
if sys.version_info.minor >= 7:
28-
29-
class Select(_Select, Generic[_TSelect]):
30-
inherit_cache = True
31-
32-
# This is not comparable to sqlalchemy.sql.selectable.ScalarSelect, that has a different
33-
# purpose. This is the same as a normal SQLAlchemy Select class where there's only one
34-
# entity, so the result will be converted to a scalar by default. This way writing
35-
# for loops on the results will feel natural.
36-
class SelectOfScalar(_Select, Generic[_TSelect]):
37-
inherit_cache = True
38-
39-
else:
40-
from typing import GenericMeta # type: ignore
41-
42-
class GenericSelectMeta(GenericMeta, _Select.__class__): # type: ignore
43-
pass
44-
45-
class _Py36Select(_Select, Generic[_TSelect], metaclass=GenericSelectMeta):
46-
inherit_cache = True
47-
48-
class _Py36SelectOfScalar(_Select, Generic[_TSelect], metaclass=GenericSelectMeta):
49-
inherit_cache = True
50-
51-
# Cast them for editors to work correctly, from several tricks tried, this works
52-
# for both VS Code and PyCharm
53-
Select = cast("Select", _Py36Select) # type: ignore
54-
SelectOfScalar = cast("SelectOfScalar", _Py36SelectOfScalar) # type: ignore
55-
25+
class Select(_Select, Generic[_TSelect]):
26+
inherit_cache = True
27+
28+
# This is not comparable to sqlalchemy.sql.selectable.ScalarSelect, that has a different
29+
# purpose. This is the same as a normal SQLAlchemy Select class where there's only one
30+
# entity, so the result will be converted to a scalar by default. This way writing
31+
# for loops on the results will feel natural.
32+
class SelectOfScalar(_Select, Generic[_TSelect]):
33+
inherit_cache = True
5634

5735
if TYPE_CHECKING: # pragma: no cover
5836
from ..main import SQLModel

0 commit comments

Comments
 (0)