Skip to content

Commit 5dda6aa

Browse files
🎨 [pre-commit.ci] Auto format from pre-commit.com hooks
1 parent 26be462 commit 5dda6aa

File tree

2 files changed

+11
-8
lines changed

2 files changed

+11
-8
lines changed

sqlmodel/main.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,14 @@
5454
from sqlalchemy.orm.instrumentation import is_instrumented
5555
from sqlalchemy.sql.schema import MetaData
5656
from sqlalchemy.sql.sqltypes import LargeBinary, Time, Uuid
57-
from typing_extensions import Annotated, Literal, TypeAlias, deprecated, get_args, get_origin
57+
from typing_extensions import (
58+
Annotated,
59+
Literal,
60+
TypeAlias,
61+
deprecated,
62+
get_args,
63+
get_origin,
64+
)
5865

5966
from ._compat import ( # type: ignore[attr-defined]
6067
IS_PYDANTIC_V2,
@@ -647,7 +654,7 @@ def __init__(
647654
ModelMetaclass.__init__(cls, classname, bases, dict_, **kw)
648655

649656

650-
def _get_sqlmodel_field_info_from_annotation(annotation: Any) -> Optional["FieldInfo"]:
657+
def _get_sqlmodel_field_info_from_annotation(annotation: Any) -> Optional[FieldInfo]:
651658
"""Extract SQLModel FieldInfo from an Annotated type's metadata.
652659
653660
When using Annotated[type, Field(...), Validator(...)], Pydantic V2 may create
@@ -736,9 +743,7 @@ def get_sqlalchemy_type(field: Any, original_annotation: Any = None) -> Any:
736743
raise ValueError(f"{type_} has no matching SQLAlchemy type")
737744

738745

739-
def get_column_from_field(
740-
field: Any, original_annotation: Any = None
741-
) -> Column: # type: ignore
746+
def get_column_from_field(field: Any, original_annotation: Any = None) -> Column: # type: ignore
742747
if IS_PYDANTIC_V2:
743748
field_info = field
744749
else:

tests/test_annotated_sa_column.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,7 @@ class Position(SQLModel, table=True):
2828
timestamp: Annotated[
2929
datetime,
3030
Field(
31-
sa_column=Column(
32-
DateTime(timezone=True), nullable=False, index=True
33-
)
31+
sa_column=Column(DateTime(timezone=True), nullable=False, index=True)
3432
),
3533
BeforeValidator(before_validate),
3634
AfterValidator(after_validate),

0 commit comments

Comments
 (0)