diff --git a/sqlalchemy-stubs/sql/sqltypes.pyi b/sqlalchemy-stubs/sql/sqltypes.pyi index 7f41b9d..aa8f094 100644 --- a/sqlalchemy-stubs/sql/sqltypes.pyi +++ b/sqlalchemy-stubs/sql/sqltypes.pyi @@ -172,6 +172,7 @@ class Enum(Emulated, String, SchemaType): native_enum: bool = ... create_constraint: bool = ... validate_strings: bool = ... + enums: List[typing_Text] = ... # This is set inside _setup_for_values. def __init__(self, *enums: Any, **kw: Any) -> None: ... @property def native(self) -> bool: ... @@ -243,7 +244,9 @@ class Interval(Emulated, _AbstractInterval[timedelta], TypeDecorator[timedelta]) def bind_processor(self, dialect: Dialect) -> Callable[[Optional[timedelta]], str]: ... def result_processor(self, dialect: Dialect, coltype: Any) -> Callable[[Optional[str]], Optional[timedelta]]: ... -class JSON(Indexable, TypeEngine[Dict[str, Any]]): +_JSONT = Union[Dict[str, Any], List[Any]] + +class JSON(Indexable, TypeEngine[_JSONT]): __visit_name__: str = ... hashable: bool = ... NULL: util.symbol = ... @@ -257,12 +260,13 @@ class JSON(Indexable, TypeEngine[Dict[str, Any]]): class JSONIndexType(JSONElementType): ... class JSONPathType(JSONElementType): ... comparator_factory: Type[Any] = ... + # This method returns `dict`, but it seems to be a bug in SQLAlchemy. @property def python_type(self) -> Type[Dict[str, Any]]: ... @property def should_evaluate_none(self) -> bool: ... # type: ignore # incompatible with supertype "TypeEngine" - def bind_processor(self, dialect: Dialect) -> Callable[[Optional[Dict[str, Any]]], Optional[str]]: ... - def result_processor(self, dialect: Dialect, coltype: Any) -> Callable[[Optional[str]], Optional[Dict[str, Any]]]: ... + def bind_processor(self, dialect: Dialect) -> Callable[[Optional[_JSONT]], Optional[str]]: ... + def result_processor(self, dialect: Dialect, coltype: Any) -> Callable[[Optional[str]], Optional[_JSONT]]: ... class ARRAY(Indexable, Concatenable, TypeEngine[List[_T]]): __visit_name__: str = ...