@@ -69,7 +69,13 @@ If the foreign table search criteria (address.zipcode) is not unique, prefer EXI
6969Let's define a ` winter_team ` and ` summer_team ` relationship for our heros. They can be on different
7070winter and summer teams or on the same team for both seasons.
7171
72- {* ./docs_src/tutorial/relationship_attributes/multiple_relationships_same_model/tutorial001_py310.py ln[ 13:26] hl[ 9,13] * }
72+ ``` Python hl_lines="9 13"
73+ # Code above omitted 👆
74+
75+ {!./ docs_src/ tutorial/ relationship_attributes/ multiple_relationships_same_model/ tutorial001.py[ln:13 - 26 ]!}
76+
77+ # Code below omitted 👇
78+ ```
7379
7480The ` sa_relationship_kwargs={"foreign_keys": ...} ` is a new bit of info we need for ** SQLAlchemy** to
7581figure out which SQL join we should use depending on which attribute is in our query.
@@ -113,7 +119,7 @@ The aliases we create are `home_address_alias` and `work_address_alias`. You ca
113119as a view to the same underlying ` address ` table. We can do this with ** SQLModel** and ** SQLAlchemy** using ` sqlalchemy.orm.aliased `
114120and a couple of extra bits of info in our ** SQLModel** join statements.
115121
116- ``` Python hl_lines="2 "
122+ ``` Python hl_lines="4 "
117123# Code above omitted 👆
118124
119125{!./ docs_src/ tutorial/ relationship_attributes/ multiple_relationships_same_model/ tutorial001.py[ln:69 - 71 ]!}
@@ -125,7 +131,7 @@ and a couple of extra bits of info in our **SQLModel** join statements.
125131
126132Query Heros filtering by Team attributes by manually specifying the ` join ` with an ` onclause ` to tell ** SQLAlchemy** to join the ` hero ` and ` team ` tables.
127133
128- ``` Python hl_lines="7 "
134+ ``` Python hl_lines="9 "
129135# Code above omitted 👆
130136
131137{!./ docs_src/ tutorial/ relationship_attributes/ multiple_relationships_same_model/ tutorial001.py[ln:69 - 89 ]!}
@@ -148,11 +154,11 @@ For more information see [SQLAlchemy: Handling Multiple Join Paths](https://docs
148154
149155///
150156
151- #### Correlated Sub Query
157+ ### Correlated Sub Query
152158
153159From a query perspecitve, this is a much simpler solution. We use the ` has ` function in the query:
154160
155- ``` Python hl_lines="4 5 "
161+ ``` Python hl_lines="6 7 "
156162# Code above omitted 👆
157163
158164{!./ docs_src/ tutorial/ relationship_attributes/ multiple_relationships_same_model/ tutorial001.py[ln:93 - 123 ]!}
0 commit comments