Skip to content

Commit 70fdb49

Browse files
committed
Remove type union pipe syntax
1 parent 88d3b2f commit 70fdb49

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

tests/test_attribute_keyed_dict.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
from enum import Enum
2+
from typing import Optional
23

34
from sqlalchemy.orm.collections import attribute_keyed_dict
45
from sqlmodel import Field, Index, Relationship, Session, SQLModel, create_engine
@@ -15,15 +16,15 @@ class Child(SQLModel, table=True):
1516
Index("ix_children_parent_id_color", "parent_id", "color", unique=True),
1617
)
1718

18-
id: int | None = Field(primary_key=True, default=None)
19+
id: Optional[int] = Field(primary_key=True, default=None)
1920
parent_id: int = Field(foreign_key="parents.id")
2021
color: Color
2122
value: int
2223

2324
class Parent(SQLModel, table=True):
2425
__tablename__ = "parents"
2526

26-
id: int | None = Field(primary_key=True, default=None)
27+
id: Optional[int] = Field(primary_key=True, default=None)
2728
children_by_color: dict[Color, Child] = Relationship(
2829
sa_relationship_kwargs={"collection_class": attribute_keyed_dict("color")}
2930
)

0 commit comments

Comments
 (0)