|
50 | 50 | from sqlalchemy.orm.attributes import set_attribute |
51 | 51 | from sqlalchemy.orm.decl_api import DeclarativeMeta |
52 | 52 | from sqlalchemy.orm.instrumentation import is_instrumented |
53 | | -from sqlalchemy.sql.schema import MetaData |
| 53 | +from sqlalchemy.sql.schema import MetaData, SchemaEventTarget |
54 | 54 | from sqlalchemy.sql.sqltypes import LargeBinary, Time, Uuid |
| 55 | +from sqlalchemy.types import TypeEngine |
55 | 56 | from typing_extensions import Literal, TypeAlias, deprecated, get_origin |
56 | 57 |
|
57 | 58 | from ._compat import ( # type: ignore[attr-defined] |
|
96 | 97 | Mapping[int, Union["IncEx", bool]], |
97 | 98 | Mapping[str, Union["IncEx", bool]], |
98 | 99 | ] |
| 100 | +SaType: TypeAlias = Union[TypeEngine[Any], Type[TypeEngine[Any]], SchemaEventTarget] |
99 | 101 | OnDeleteType = Literal["CASCADE", "SET NULL", "RESTRICT"] |
100 | 102 |
|
101 | 103 |
|
@@ -245,7 +247,7 @@ def Field( |
245 | 247 | unique: Union[bool, UndefinedType] = Undefined, |
246 | 248 | nullable: Union[bool, UndefinedType] = Undefined, |
247 | 249 | index: Union[bool, UndefinedType] = Undefined, |
248 | | - sa_type: Union[Type[Any], UndefinedType] = Undefined, |
| 250 | + sa_type: Union[SaType, UndefinedType] = Undefined, |
249 | 251 | sa_column_args: Union[Sequence[Any], UndefinedType] = Undefined, |
250 | 252 | sa_column_kwargs: Union[Mapping[str, Any], UndefinedType] = Undefined, |
251 | 253 | schema_extra: Optional[Dict[str, Any]] = None, |
@@ -291,7 +293,7 @@ def Field( |
291 | 293 | unique: Union[bool, UndefinedType] = Undefined, |
292 | 294 | nullable: Union[bool, UndefinedType] = Undefined, |
293 | 295 | index: Union[bool, UndefinedType] = Undefined, |
294 | | - sa_type: Union[Type[Any], UndefinedType] = Undefined, |
| 296 | + sa_type: Union[SaType, UndefinedType] = Undefined, |
295 | 297 | sa_column_args: Union[Sequence[Any], UndefinedType] = Undefined, |
296 | 298 | sa_column_kwargs: Union[Mapping[str, Any], UndefinedType] = Undefined, |
297 | 299 | schema_extra: Optional[Dict[str, Any]] = None, |
@@ -380,7 +382,7 @@ def Field( |
380 | 382 | unique: Union[bool, UndefinedType] = Undefined, |
381 | 383 | nullable: Union[bool, UndefinedType] = Undefined, |
382 | 384 | index: Union[bool, UndefinedType] = Undefined, |
383 | | - sa_type: Union[Type[Any], UndefinedType] = Undefined, |
| 385 | + sa_type: Union[SaType, UndefinedType] = Undefined, |
384 | 386 | sa_column: Union[Column, UndefinedType] = Undefined, # type: ignore |
385 | 387 | sa_column_args: Union[Sequence[Any], UndefinedType] = Undefined, |
386 | 388 | sa_column_kwargs: Union[Mapping[str, Any], UndefinedType] = Undefined, |
|
0 commit comments