| 40 | |
| 41 | |
| 42 | class Address(Base): |
| 43 | __tablename__ = "address" |
| 44 | |
| 45 | id = mapped_column(Integer, primary_key=True) |
| 46 | user_id = mapped_column(ForeignKey("user.id")) |
| 47 | email = mapped_column(String, nullable=False) |
| 48 | |
| 49 | user_style_one = relationship(User) |
| 50 | |
| 51 | user_style_one_typed: Mapped[User] = relationship(User) |
| 52 | |
| 53 | user_style_two = relationship("User") |
| 54 | |
| 55 | user_style_two_typed: Mapped["User"] = relationship("User") |
| 56 | |
| 57 | # this is obviously not correct relationally but want to see the typing |
| 58 | # work out |
| 59 | user_style_three: Mapped[List[User]] = relationship(User) |
| 60 | |
| 61 | user_style_four: Mapped[List[User]] = relationship("User") |
| 62 | |
| 63 | user_style_five = relationship(User, collection_class=set) |
| 64 | |
| 65 | user_fk_style_one: Mapped[List[User]] = relationship( |
| 66 | foreign_keys="Address.user_id" |
| 67 | ) |
| 68 | user_fk_style_two: Mapped[List[User]] = relationship( |
| 69 | foreign_keys=lambda: Address.user_id |
| 70 | ) |
| 71 | user_fk_style_three: Mapped[List[User]] = relationship( |
| 72 | foreign_keys=[user_id] |
| 73 | ) |
| 74 | user_pj_style_one: Mapped[List[User]] = relationship( |
| 75 | primaryjoin=user_id == User.id |
| 76 | ) |
| 77 | user_pj_style_two: Mapped[List[User]] = relationship( |
| 78 | primaryjoin=lambda: Address.user_id == User.id |
| 79 | ) |
| 80 | user_pj_style_three: Mapped[List[User]] = relationship( |
| 81 | primaryjoin="Address.user_id == User.id" |
| 82 | ) |
| 83 | |
| 84 | |
| 85 | if typing.TYPE_CHECKING: |
nothing calls this directly
no test coverage detected