Skip to content

Commit c4246dc

Browse files
committed
Update docs/tutorial/relationship-attributes/read-relationships.md
1 parent 893f8bd commit c4246dc

File tree

1 file changed

+8
-256
lines changed

1 file changed

+8
-256
lines changed

docs/tutorial/relationship-attributes/read-relationships.md

Lines changed: 8 additions & 256 deletions
Original file line numberDiff line numberDiff line change
@@ -6,79 +6,11 @@ Now that we know how to connect data using **relationship Attributes**, let's se
66

77
First, add a function `select_heroes()` where we get a hero to start working with, and add that function to the `main()` function:
88

9-
//// tab | Python 3.10+
10-
11-
```Python hl_lines="3-7 14"
12-
# Code above omitted 👆
13-
14-
{!./docs_src/tutorial/relationship_attributes/read_relationships/tutorial001_py310.py[ln:94-98]!}
15-
16-
# Previous code here omitted 👈
17-
18-
{!./docs_src/tutorial/relationship_attributes/read_relationships/tutorial001_py310.py[ln:108-111]!}
19-
20-
# Code below omitted 👇
21-
```
22-
23-
////
24-
25-
//// tab | Python 3.9+
26-
27-
```Python hl_lines="3-7 14"
28-
# Code above omitted 👆
29-
30-
{!./docs_src/tutorial/relationship_attributes/read_relationships/tutorial001_py39.py[ln:96-100]!}
31-
32-
# Previous code here omitted 👈
33-
34-
{!./docs_src/tutorial/relationship_attributes/read_relationships/tutorial001_py39.py[ln:110-113]!}
35-
36-
# Code below omitted 👇
37-
```
38-
39-
////
40-
41-
//// tab | Python 3.7+
42-
43-
```Python hl_lines="3-7 14"
44-
# Code above omitted 👆
45-
46-
{!./docs_src/tutorial/relationship_attributes/read_relationships/tutorial001.py[ln:96-100]!}
47-
48-
# Previous code here omitted 👈
49-
50-
{!./docs_src/tutorial/relationship_attributes/read_relationships/tutorial001.py[ln:110-113]!}
51-
52-
# Code below omitted 👇
53-
```
54-
55-
////
9+
{* ./docs_src/tutorial/relationship_attributes/read_relationships/tutorial001_py310.py ln[94:98] hl[3:7,14] *}
5610

5711
/// details | 👀 Full file preview
5812

59-
//// tab | Python 3.10+
60-
61-
```Python
62-
{!./docs_src/tutorial/relationship_attributes/read_relationships/tutorial001_py310.py!}
63-
```
64-
65-
////
66-
67-
//// tab | Python 3.9+
68-
69-
```Python
70-
{!./docs_src/tutorial/relationship_attributes/read_relationships/tutorial001_py39.py!}
71-
```
72-
73-
////
74-
75-
//// tab | Python 3.7+
76-
77-
```Python
78-
{!./docs_src/tutorial/relationship_attributes/read_relationships/tutorial001.py!}
79-
```
80-
81-
////
13+
{* ./docs_src/tutorial/relationship_attributes/read_relationships/tutorial001_py310.py *}
8214

8315
///
8416

@@ -88,67 +20,11 @@ Now that we have a hero, we can get the team this hero belongs to.
8820

8921
With what we have learned **up to now**, we could use a `select()` statement, then execute it with `session.exec()`, and then get the `.first()` result, for example:
9022

91-
//// tab | Python 3.10+
92-
93-
```Python hl_lines="9-12"
94-
# Code above omitted 👆
95-
96-
{!./docs_src/tutorial/relationship_attributes/read_relationships/tutorial001_py310.py[ln:94-103]!}
97-
98-
# Code below omitted 👇
99-
```
100-
101-
////
102-
103-
//// tab | Python 3.9+
104-
105-
```Python hl_lines="9-12"
106-
# Code above omitted 👆
107-
108-
{!./docs_src/tutorial/relationship_attributes/read_relationships/tutorial001_py39.py[ln:96-105]!}
109-
110-
# Code below omitted 👇
111-
```
112-
113-
////
114-
115-
//// tab | Python 3.7+
116-
117-
```Python hl_lines="9-12"
118-
# Code above omitted 👆
119-
120-
{!./docs_src/tutorial/relationship_attributes/read_relationships/tutorial001.py[ln:96-105]!}
121-
122-
# Code below omitted 👇
123-
```
124-
125-
////
23+
{* ./docs_src/tutorial/relationship_attributes/read_relationships/tutorial001_py310.py ln[94:103] hl[9:12] *}
12624

12725
/// details | 👀 Full file preview
12826

129-
//// tab | Python 3.10+
130-
131-
```Python
132-
{!./docs_src/tutorial/relationship_attributes/read_relationships/tutorial001_py310.py!}
133-
```
134-
135-
////
136-
137-
//// tab | Python 3.9+
138-
139-
```Python
140-
{!./docs_src/tutorial/relationship_attributes/read_relationships/tutorial001_py39.py!}
141-
```
142-
143-
////
144-
145-
//// tab | Python 3.7+
146-
147-
```Python
148-
{!./docs_src/tutorial/relationship_attributes/read_relationships/tutorial001.py!}
149-
```
150-
151-
////
27+
{* ./docs_src/tutorial/relationship_attributes/read_relationships/tutorial001_py310.py *}
15228

15329
///
15430

@@ -158,79 +34,11 @@ But now that we have the **relationship attributes**, we can just access them, a
15834

15935
So, the highlighted block above, has the same results as the block below:
16036

161-
//// tab | Python 3.10+
162-
163-
```Python hl_lines="11"
164-
# Code above omitted 👆
165-
166-
{!./docs_src/tutorial/relationship_attributes/read_relationships/tutorial001_py310.py[ln:94-98]!}
167-
168-
# Code from the previous example omitted 👈
169-
170-
{!./docs_src/tutorial/relationship_attributes/read_relationships/tutorial001_py310.py[ln:105]!}
171-
172-
# Code below omitted 👇
173-
```
174-
175-
////
176-
177-
//// tab | Python 3.9+
178-
179-
```Python hl_lines="11"
180-
# Code above omitted 👆
181-
182-
{!./docs_src/tutorial/relationship_attributes/read_relationships/tutorial001_py39.py[ln:96-100]!}
183-
184-
# Code from the previous example omitted 👈
185-
186-
{!./docs_src/tutorial/relationship_attributes/read_relationships/tutorial001_py39.py[ln:107]!}
187-
188-
# Code below omitted 👇
189-
```
190-
191-
////
192-
193-
//// tab | Python 3.7+
194-
195-
```Python hl_lines="11"
196-
# Code above omitted 👆
197-
198-
{!./docs_src/tutorial/relationship_attributes/read_relationships/tutorial001.py[ln:96-100]!}
199-
200-
# Code from the previous example omitted 👈
201-
202-
{!./docs_src/tutorial/relationship_attributes/read_relationships/tutorial001.py[ln:107]!}
203-
204-
# Code below omitted 👇
205-
```
206-
207-
////
37+
{* ./docs_src/tutorial/relationship_attributes/read_relationships/tutorial001_py310.py ln[94:98] hl[11] *}
20838

20939
/// details | 👀 Full file preview
21040

211-
//// tab | Python 3.10+
212-
213-
```Python
214-
{!./docs_src/tutorial/relationship_attributes/read_relationships/tutorial001_py310.py!}
215-
```
216-
217-
////
218-
219-
//// tab | Python 3.9+
220-
221-
```Python
222-
{!./docs_src/tutorial/relationship_attributes/read_relationships/tutorial001_py39.py!}
223-
```
224-
225-
////
226-
227-
//// tab | Python 3.7+
228-
229-
```Python
230-
{!./docs_src/tutorial/relationship_attributes/read_relationships/tutorial001.py!}
231-
```
232-
233-
////
41+
{* ./docs_src/tutorial/relationship_attributes/read_relationships/tutorial001_py310.py *}
23442

23543
///
23644

@@ -246,67 +54,11 @@ For example, here, **inside** a `with` block with a `Session` object.
24654

24755
And the same way, when we are working on the **many** side of the **one-to-many** relationship, we can get a list of of the related objects just by accessing the relationship attribute:
24856

249-
//// tab | Python 3.10+
250-
251-
```Python hl_lines="9"
252-
# Code above omitted 👆
253-
254-
{!./docs_src/tutorial/relationship_attributes/read_relationships/tutorial002_py310.py[ln:94-100]!}
255-
256-
# Code below omitted 👇
257-
```
258-
259-
////
260-
261-
//// tab | Python 3.9+
262-
263-
```Python hl_lines="9"
264-
# Code above omitted 👆
265-
266-
{!./docs_src/tutorial/relationship_attributes/read_relationships/tutorial002_py39.py[ln:96-102]!}
267-
268-
# Code below omitted 👇
269-
```
270-
271-
////
272-
273-
//// tab | Python 3.7+
274-
275-
```Python hl_lines="9"
276-
# Code above omitted 👆
277-
278-
{!./docs_src/tutorial/relationship_attributes/read_relationships/tutorial002.py[ln:96-102]!}
279-
280-
# Code below omitted 👇
281-
```
282-
283-
////
57+
{* ./docs_src/tutorial/relationship_attributes/read_relationships/tutorial002_py310.py ln[94:100] hl[9] *}
28458

28559
/// details | 👀 Full file preview
28660

287-
//// tab | Python 3.10+
288-
289-
```Python
290-
{!./docs_src/tutorial/relationship_attributes/read_relationships/tutorial002_py310.py!}
291-
```
292-
293-
////
294-
295-
//// tab | Python 3.9+
296-
297-
```Python
298-
{!./docs_src/tutorial/relationship_attributes/read_relationships/tutorial002_py39.py!}
299-
```
300-
301-
////
302-
303-
//// tab | Python 3.7+
304-
305-
```Python
306-
{!./docs_src/tutorial/relationship_attributes/read_relationships/tutorial002.py!}
307-
```
308-
309-
////
61+
{* ./docs_src/tutorial/relationship_attributes/read_relationships/tutorial002_py310.py *}
31062

31163
///
31264

0 commit comments

Comments
 (0)