Skip to content

Commit

Permalink
🐛 Update type annotations for compatibility with Python 3.6
Browse files Browse the repository at this point in the history
  • Loading branch information
tiangolo committed Nov 30, 2021
1 parent 6bd5cd8 commit ec95a7f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion sqlmodel/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ def Field(
foreign_key: Optional[Any] = None,
nullable: Union[bool, UndefinedType] = Undefined,
index: Union[bool, UndefinedType] = Undefined,
sa_column: Union[Column[Any], UndefinedType] = Undefined,
sa_column: Union[Column, UndefinedType] = Undefined, # type: ignore
sa_column_args: Union[Sequence[Any], UndefinedType] = Undefined,
sa_column_kwargs: Union[Mapping[str, Any], UndefinedType] = Undefined,
schema_extra: Optional[Dict[str, Any]] = None,
Expand Down
6 changes: 3 additions & 3 deletions sqlmodel/sql/sqltypes.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from sqlalchemy.types import CHAR, TypeDecorator


class AutoString(types.TypeDecorator[types.String]):
class AutoString(types.TypeDecorator): # type: ignore

impl = types.String
cache_ok = True
Expand All @@ -23,7 +23,7 @@ def load_dialect_impl(self, dialect: Dialect) -> "types.TypeEngine[Any]":

# Reference form SQLAlchemy docs: https://docs.sqlalchemy.org/en/14/core/custom_types.html#backend-agnostic-guid-type
# with small modifications
class GUID(TypeDecorator[Any]):
class GUID(TypeDecorator): # type: ignore
"""Platform-independent GUID type.
Uses PostgreSQL's UUID type, otherwise uses
Expand All @@ -34,7 +34,7 @@ class GUID(TypeDecorator[Any]):
impl = CHAR
cache_ok = True

def load_dialect_impl(self, dialect: Dialect) -> TypeEngine[Any]:
def load_dialect_impl(self, dialect: Dialect) -> TypeEngine: # type: ignore
if dialect.name == "postgresql":
return dialect.type_descriptor(UUID()) # type: ignore
else:
Expand Down

0 comments on commit ec95a7f

Please sign in to comment.