Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions sqlmodel/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,9 @@
from sqlalchemy.orm.attributes import set_attribute
from sqlalchemy.orm.decl_api import DeclarativeMeta
from sqlalchemy.orm.instrumentation import is_instrumented
from sqlalchemy.sql.schema import MetaData
from sqlalchemy.sql.schema import MetaData, SchemaEventTarget
from sqlalchemy.sql.sqltypes import LargeBinary, Time, Uuid
from sqlalchemy.types import TypeEngine
from typing_extensions import deprecated

from ._compat import (
Expand Down Expand Up @@ -87,6 +88,9 @@
| Mapping[int, Union["IncEx", bool]]
| Mapping[str, Union["IncEx", bool]]
)
SaTypeOrInstance: TypeAlias = (
TypeEngine[Any] | type[TypeEngine[Any]] | SchemaEventTarget
)
OnDeleteType = Literal["CASCADE", "SET NULL", "RESTRICT"]


Expand Down Expand Up @@ -208,7 +212,7 @@ class FieldInfoMetadata:
ondelete: OnDeleteType | UndefinedType = Undefined
unique: bool | UndefinedType = Undefined
index: bool | UndefinedType = Undefined
sa_type: type[Any] | UndefinedType = Undefined
sa_type: SaTypeOrInstance | UndefinedType = Undefined
sa_column: Column[Any] | UndefinedType = Undefined
sa_column_args: Sequence[Any] | UndefinedType = Undefined
sa_column_kwargs: Mapping[str, Any] | UndefinedType = Undefined
Expand Down Expand Up @@ -267,7 +271,7 @@ def Field(
unique: bool | UndefinedType = Undefined,
nullable: bool | UndefinedType = Undefined,
index: bool | UndefinedType = Undefined,
sa_type: type[Any] | UndefinedType = Undefined,
sa_type: SaTypeOrInstance | UndefinedType = Undefined,
sa_column_args: Sequence[Any] | UndefinedType = Undefined,
sa_column_kwargs: Mapping[str, Any] | UndefinedType = Undefined,
schema_extra: dict[str, Any] | None = None,
Expand Down Expand Up @@ -311,7 +315,7 @@ def Field(
unique: bool | UndefinedType = Undefined,
nullable: bool | UndefinedType = Undefined,
index: bool | UndefinedType = Undefined,
sa_type: type[Any] | UndefinedType = Undefined,
sa_type: SaTypeOrInstance | UndefinedType = Undefined,
sa_column_args: Sequence[Any] | UndefinedType = Undefined,
sa_column_kwargs: Mapping[str, Any] | UndefinedType = Undefined,
schema_extra: dict[str, Any] | None = None,
Expand Down Expand Up @@ -396,7 +400,7 @@ def Field(
unique: bool | UndefinedType = Undefined,
nullable: bool | UndefinedType = Undefined,
index: bool | UndefinedType = Undefined,
sa_type: type[Any] | UndefinedType = Undefined,
sa_type: SaTypeOrInstance | UndefinedType = Undefined,
sa_column: Column | UndefinedType = Undefined,
sa_column_args: Sequence[Any] | UndefinedType = Undefined,
sa_column_kwargs: Mapping[str, Any] | UndefinedType = Undefined,
Expand Down
Loading