mirror of
https://github.com/fastapi/sqlmodel.git
synced 2026-03-13 09:29:54 +08:00
➖ Drop support for Python 3.8 (#1696)
This commit is contained in:
committed by
GitHub
parent
028ad29203
commit
056232ab45
@@ -1,5 +1,4 @@
|
||||
from typing import (
|
||||
Tuple,
|
||||
TypeVar,
|
||||
Union,
|
||||
)
|
||||
@@ -15,7 +14,7 @@ _T = TypeVar("_T")
|
||||
|
||||
# Separate this class in SelectBase, Select, and SelectOfScalar so that they can share
|
||||
# where and having without having type overlap incompatibility in session.exec().
|
||||
class SelectBase(_Select[Tuple[_T]]):
|
||||
class SelectBase(_Select[tuple[_T]]):
|
||||
inherit_cache = True
|
||||
|
||||
def where(self, *whereclause: Union[_ColumnExpressionArgument[bool], bool]) -> Self:
|
||||
|
||||
@@ -1,12 +1,9 @@
|
||||
# WARNING: do not modify this code, it is generated by _expression_select_gen.py.jinja2
|
||||
|
||||
from collections.abc import Mapping, Sequence
|
||||
from datetime import datetime
|
||||
from typing import (
|
||||
Any,
|
||||
Mapping,
|
||||
Sequence,
|
||||
Tuple,
|
||||
Type,
|
||||
TypeVar,
|
||||
Union,
|
||||
overload,
|
||||
@@ -29,7 +26,7 @@ _T = TypeVar("_T")
|
||||
_TCCA = Union[
|
||||
TypedColumnsClauseRole[_T],
|
||||
SQLCoreOperations[_T],
|
||||
Type[_T],
|
||||
type[_T],
|
||||
]
|
||||
|
||||
# Generated TypeVars start
|
||||
@@ -126,28 +123,28 @@ def select(__ent0: _TScalar_0) -> SelectOfScalar[_TScalar_0]: # type: ignore
|
||||
def select( # type: ignore
|
||||
__ent0: _TCCA[_T0],
|
||||
__ent1: _TCCA[_T1],
|
||||
) -> Select[Tuple[_T0, _T1]]: ...
|
||||
) -> Select[tuple[_T0, _T1]]: ...
|
||||
|
||||
|
||||
@overload
|
||||
def select( # type: ignore
|
||||
__ent0: _TCCA[_T0],
|
||||
entity_1: _TScalar_1,
|
||||
) -> Select[Tuple[_T0, _TScalar_1]]: ...
|
||||
) -> Select[tuple[_T0, _TScalar_1]]: ...
|
||||
|
||||
|
||||
@overload
|
||||
def select( # type: ignore
|
||||
entity_0: _TScalar_0,
|
||||
__ent1: _TCCA[_T1],
|
||||
) -> Select[Tuple[_TScalar_0, _T1]]: ...
|
||||
) -> Select[tuple[_TScalar_0, _T1]]: ...
|
||||
|
||||
|
||||
@overload
|
||||
def select( # type: ignore
|
||||
entity_0: _TScalar_0,
|
||||
entity_1: _TScalar_1,
|
||||
) -> Select[Tuple[_TScalar_0, _TScalar_1]]: ...
|
||||
) -> Select[tuple[_TScalar_0, _TScalar_1]]: ...
|
||||
|
||||
|
||||
@overload
|
||||
@@ -155,7 +152,7 @@ def select( # type: ignore
|
||||
__ent0: _TCCA[_T0],
|
||||
__ent1: _TCCA[_T1],
|
||||
__ent2: _TCCA[_T2],
|
||||
) -> Select[Tuple[_T0, _T1, _T2]]: ...
|
||||
) -> Select[tuple[_T0, _T1, _T2]]: ...
|
||||
|
||||
|
||||
@overload
|
||||
@@ -163,7 +160,7 @@ def select( # type: ignore
|
||||
__ent0: _TCCA[_T0],
|
||||
__ent1: _TCCA[_T1],
|
||||
entity_2: _TScalar_2,
|
||||
) -> Select[Tuple[_T0, _T1, _TScalar_2]]: ...
|
||||
) -> Select[tuple[_T0, _T1, _TScalar_2]]: ...
|
||||
|
||||
|
||||
@overload
|
||||
@@ -171,7 +168,7 @@ def select( # type: ignore
|
||||
__ent0: _TCCA[_T0],
|
||||
entity_1: _TScalar_1,
|
||||
__ent2: _TCCA[_T2],
|
||||
) -> Select[Tuple[_T0, _TScalar_1, _T2]]: ...
|
||||
) -> Select[tuple[_T0, _TScalar_1, _T2]]: ...
|
||||
|
||||
|
||||
@overload
|
||||
@@ -179,7 +176,7 @@ def select( # type: ignore
|
||||
__ent0: _TCCA[_T0],
|
||||
entity_1: _TScalar_1,
|
||||
entity_2: _TScalar_2,
|
||||
) -> Select[Tuple[_T0, _TScalar_1, _TScalar_2]]: ...
|
||||
) -> Select[tuple[_T0, _TScalar_1, _TScalar_2]]: ...
|
||||
|
||||
|
||||
@overload
|
||||
@@ -187,7 +184,7 @@ def select( # type: ignore
|
||||
entity_0: _TScalar_0,
|
||||
__ent1: _TCCA[_T1],
|
||||
__ent2: _TCCA[_T2],
|
||||
) -> Select[Tuple[_TScalar_0, _T1, _T2]]: ...
|
||||
) -> Select[tuple[_TScalar_0, _T1, _T2]]: ...
|
||||
|
||||
|
||||
@overload
|
||||
@@ -195,7 +192,7 @@ def select( # type: ignore
|
||||
entity_0: _TScalar_0,
|
||||
__ent1: _TCCA[_T1],
|
||||
entity_2: _TScalar_2,
|
||||
) -> Select[Tuple[_TScalar_0, _T1, _TScalar_2]]: ...
|
||||
) -> Select[tuple[_TScalar_0, _T1, _TScalar_2]]: ...
|
||||
|
||||
|
||||
@overload
|
||||
@@ -203,7 +200,7 @@ def select( # type: ignore
|
||||
entity_0: _TScalar_0,
|
||||
entity_1: _TScalar_1,
|
||||
__ent2: _TCCA[_T2],
|
||||
) -> Select[Tuple[_TScalar_0, _TScalar_1, _T2]]: ...
|
||||
) -> Select[tuple[_TScalar_0, _TScalar_1, _T2]]: ...
|
||||
|
||||
|
||||
@overload
|
||||
@@ -211,7 +208,7 @@ def select( # type: ignore
|
||||
entity_0: _TScalar_0,
|
||||
entity_1: _TScalar_1,
|
||||
entity_2: _TScalar_2,
|
||||
) -> Select[Tuple[_TScalar_0, _TScalar_1, _TScalar_2]]: ...
|
||||
) -> Select[tuple[_TScalar_0, _TScalar_1, _TScalar_2]]: ...
|
||||
|
||||
|
||||
@overload
|
||||
@@ -220,7 +217,7 @@ def select( # type: ignore
|
||||
__ent1: _TCCA[_T1],
|
||||
__ent2: _TCCA[_T2],
|
||||
__ent3: _TCCA[_T3],
|
||||
) -> Select[Tuple[_T0, _T1, _T2, _T3]]: ...
|
||||
) -> Select[tuple[_T0, _T1, _T2, _T3]]: ...
|
||||
|
||||
|
||||
@overload
|
||||
@@ -229,7 +226,7 @@ def select( # type: ignore
|
||||
__ent1: _TCCA[_T1],
|
||||
__ent2: _TCCA[_T2],
|
||||
entity_3: _TScalar_3,
|
||||
) -> Select[Tuple[_T0, _T1, _T2, _TScalar_3]]: ...
|
||||
) -> Select[tuple[_T0, _T1, _T2, _TScalar_3]]: ...
|
||||
|
||||
|
||||
@overload
|
||||
@@ -238,7 +235,7 @@ def select( # type: ignore
|
||||
__ent1: _TCCA[_T1],
|
||||
entity_2: _TScalar_2,
|
||||
__ent3: _TCCA[_T3],
|
||||
) -> Select[Tuple[_T0, _T1, _TScalar_2, _T3]]: ...
|
||||
) -> Select[tuple[_T0, _T1, _TScalar_2, _T3]]: ...
|
||||
|
||||
|
||||
@overload
|
||||
@@ -247,7 +244,7 @@ def select( # type: ignore
|
||||
__ent1: _TCCA[_T1],
|
||||
entity_2: _TScalar_2,
|
||||
entity_3: _TScalar_3,
|
||||
) -> Select[Tuple[_T0, _T1, _TScalar_2, _TScalar_3]]: ...
|
||||
) -> Select[tuple[_T0, _T1, _TScalar_2, _TScalar_3]]: ...
|
||||
|
||||
|
||||
@overload
|
||||
@@ -256,7 +253,7 @@ def select( # type: ignore
|
||||
entity_1: _TScalar_1,
|
||||
__ent2: _TCCA[_T2],
|
||||
__ent3: _TCCA[_T3],
|
||||
) -> Select[Tuple[_T0, _TScalar_1, _T2, _T3]]: ...
|
||||
) -> Select[tuple[_T0, _TScalar_1, _T2, _T3]]: ...
|
||||
|
||||
|
||||
@overload
|
||||
@@ -265,7 +262,7 @@ def select( # type: ignore
|
||||
entity_1: _TScalar_1,
|
||||
__ent2: _TCCA[_T2],
|
||||
entity_3: _TScalar_3,
|
||||
) -> Select[Tuple[_T0, _TScalar_1, _T2, _TScalar_3]]: ...
|
||||
) -> Select[tuple[_T0, _TScalar_1, _T2, _TScalar_3]]: ...
|
||||
|
||||
|
||||
@overload
|
||||
@@ -274,7 +271,7 @@ def select( # type: ignore
|
||||
entity_1: _TScalar_1,
|
||||
entity_2: _TScalar_2,
|
||||
__ent3: _TCCA[_T3],
|
||||
) -> Select[Tuple[_T0, _TScalar_1, _TScalar_2, _T3]]: ...
|
||||
) -> Select[tuple[_T0, _TScalar_1, _TScalar_2, _T3]]: ...
|
||||
|
||||
|
||||
@overload
|
||||
@@ -283,7 +280,7 @@ def select( # type: ignore
|
||||
entity_1: _TScalar_1,
|
||||
entity_2: _TScalar_2,
|
||||
entity_3: _TScalar_3,
|
||||
) -> Select[Tuple[_T0, _TScalar_1, _TScalar_2, _TScalar_3]]: ...
|
||||
) -> Select[tuple[_T0, _TScalar_1, _TScalar_2, _TScalar_3]]: ...
|
||||
|
||||
|
||||
@overload
|
||||
@@ -292,7 +289,7 @@ def select( # type: ignore
|
||||
__ent1: _TCCA[_T1],
|
||||
__ent2: _TCCA[_T2],
|
||||
__ent3: _TCCA[_T3],
|
||||
) -> Select[Tuple[_TScalar_0, _T1, _T2, _T3]]: ...
|
||||
) -> Select[tuple[_TScalar_0, _T1, _T2, _T3]]: ...
|
||||
|
||||
|
||||
@overload
|
||||
@@ -301,7 +298,7 @@ def select( # type: ignore
|
||||
__ent1: _TCCA[_T1],
|
||||
__ent2: _TCCA[_T2],
|
||||
entity_3: _TScalar_3,
|
||||
) -> Select[Tuple[_TScalar_0, _T1, _T2, _TScalar_3]]: ...
|
||||
) -> Select[tuple[_TScalar_0, _T1, _T2, _TScalar_3]]: ...
|
||||
|
||||
|
||||
@overload
|
||||
@@ -310,7 +307,7 @@ def select( # type: ignore
|
||||
__ent1: _TCCA[_T1],
|
||||
entity_2: _TScalar_2,
|
||||
__ent3: _TCCA[_T3],
|
||||
) -> Select[Tuple[_TScalar_0, _T1, _TScalar_2, _T3]]: ...
|
||||
) -> Select[tuple[_TScalar_0, _T1, _TScalar_2, _T3]]: ...
|
||||
|
||||
|
||||
@overload
|
||||
@@ -319,7 +316,7 @@ def select( # type: ignore
|
||||
__ent1: _TCCA[_T1],
|
||||
entity_2: _TScalar_2,
|
||||
entity_3: _TScalar_3,
|
||||
) -> Select[Tuple[_TScalar_0, _T1, _TScalar_2, _TScalar_3]]: ...
|
||||
) -> Select[tuple[_TScalar_0, _T1, _TScalar_2, _TScalar_3]]: ...
|
||||
|
||||
|
||||
@overload
|
||||
@@ -328,7 +325,7 @@ def select( # type: ignore
|
||||
entity_1: _TScalar_1,
|
||||
__ent2: _TCCA[_T2],
|
||||
__ent3: _TCCA[_T3],
|
||||
) -> Select[Tuple[_TScalar_0, _TScalar_1, _T2, _T3]]: ...
|
||||
) -> Select[tuple[_TScalar_0, _TScalar_1, _T2, _T3]]: ...
|
||||
|
||||
|
||||
@overload
|
||||
@@ -337,7 +334,7 @@ def select( # type: ignore
|
||||
entity_1: _TScalar_1,
|
||||
__ent2: _TCCA[_T2],
|
||||
entity_3: _TScalar_3,
|
||||
) -> Select[Tuple[_TScalar_0, _TScalar_1, _T2, _TScalar_3]]: ...
|
||||
) -> Select[tuple[_TScalar_0, _TScalar_1, _T2, _TScalar_3]]: ...
|
||||
|
||||
|
||||
@overload
|
||||
@@ -346,7 +343,7 @@ def select( # type: ignore
|
||||
entity_1: _TScalar_1,
|
||||
entity_2: _TScalar_2,
|
||||
__ent3: _TCCA[_T3],
|
||||
) -> Select[Tuple[_TScalar_0, _TScalar_1, _TScalar_2, _T3]]: ...
|
||||
) -> Select[tuple[_TScalar_0, _TScalar_1, _TScalar_2, _T3]]: ...
|
||||
|
||||
|
||||
@overload
|
||||
@@ -355,7 +352,7 @@ def select( # type: ignore
|
||||
entity_1: _TScalar_1,
|
||||
entity_2: _TScalar_2,
|
||||
entity_3: _TScalar_3,
|
||||
) -> Select[Tuple[_TScalar_0, _TScalar_1, _TScalar_2, _TScalar_3]]: ...
|
||||
) -> Select[tuple[_TScalar_0, _TScalar_1, _TScalar_2, _TScalar_3]]: ...
|
||||
|
||||
|
||||
# Generated overloads end
|
||||
|
||||
@@ -1,10 +1,7 @@
|
||||
from collections.abc import Mapping, Sequence
|
||||
from datetime import datetime
|
||||
from typing import (
|
||||
Any,
|
||||
Mapping,
|
||||
Sequence,
|
||||
Tuple,
|
||||
Type,
|
||||
TypeVar,
|
||||
Union,
|
||||
overload,
|
||||
@@ -27,7 +24,7 @@ _T = TypeVar("_T")
|
||||
_TCCA = Union[
|
||||
TypedColumnsClauseRole[_T],
|
||||
SQLCoreOperations[_T],
|
||||
Type[_T],
|
||||
type[_T],
|
||||
]
|
||||
|
||||
# Generated TypeVars start
|
||||
@@ -71,7 +68,7 @@ def select(__ent0: _TScalar_0) -> SelectOfScalar[_TScalar_0]: # type: ignore
|
||||
@overload
|
||||
def select( # type: ignore
|
||||
{% for arg in signature[0] %}{{ arg.name }}: {{ arg.annotation }}, {% endfor %}
|
||||
) -> Select[Tuple[{%for ret in signature[1] %}{{ ret }} {% if not loop.last %}, {% endif %}{% endfor %}]]: ...
|
||||
) -> Select[tuple[{%for ret in signature[1] %}{{ ret }} {% if not loop.last %}, {% endif %}{% endfor %}]]: ...
|
||||
|
||||
{% endfor %}
|
||||
|
||||
|
||||
@@ -1,11 +1,7 @@
|
||||
from collections.abc import Iterable, Mapping, Sequence
|
||||
from typing import (
|
||||
Any,
|
||||
Iterable,
|
||||
Mapping,
|
||||
Optional,
|
||||
Sequence,
|
||||
Tuple,
|
||||
Type,
|
||||
TypeVar,
|
||||
Union,
|
||||
)
|
||||
@@ -46,7 +42,7 @@ from ._expression_select_gen import select as select
|
||||
|
||||
_T = TypeVar("_T")
|
||||
|
||||
_TypeEngineArgument = Union[Type[TypeEngine[_T]], TypeEngine[_T]]
|
||||
_TypeEngineArgument = Union[type[TypeEngine[_T]], TypeEngine[_T]]
|
||||
|
||||
# Redefine operatos that would only take a column expresion to also take the (virtual)
|
||||
# types of Pydantic models, e.g. str instead of only Mapped[str].
|
||||
@@ -94,7 +90,7 @@ def not_(clause: Union[_ColumnExpressionArgument[_T], _T]) -> ColumnElement[_T]:
|
||||
|
||||
def case(
|
||||
*whens: Union[
|
||||
Tuple[Union[_ColumnExpressionArgument[bool], bool], Any], Mapping[Any, Any]
|
||||
tuple[Union[_ColumnExpressionArgument[bool], bool], Any], Mapping[Any, Any]
|
||||
],
|
||||
value: Optional[Any] = None,
|
||||
else_: Optional[Any] = None,
|
||||
@@ -181,8 +177,8 @@ def over(
|
||||
Any,
|
||||
]
|
||||
] = None,
|
||||
range_: Optional[Tuple[Optional[int], Optional[int]]] = None,
|
||||
rows: Optional[Tuple[Optional[int], Optional[int]]] = None,
|
||||
range_: Optional[tuple[Optional[int], Optional[int]]] = None,
|
||||
rows: Optional[tuple[Optional[int], Optional[int]]] = None,
|
||||
) -> Over[_T]:
|
||||
return sqlalchemy.over(
|
||||
element, partition_by=partition_by, order_by=order_by, range_=range_, rows=rows
|
||||
@@ -192,7 +188,7 @@ def over(
|
||||
def tuple_(
|
||||
*clauses: Union[_ColumnExpressionArgument[Any], Any],
|
||||
types: Optional[Sequence["_TypeEngineArgument[Any]"]] = None,
|
||||
) -> Tuple[Any, ...]:
|
||||
) -> tuple[Any, ...]:
|
||||
return sqlalchemy.tuple_(*clauses, types=types) # type: ignore[return-value]
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user