Skip to content

Commit 240b9a3

Browse files
committed
📝 Update includes for docs/tutorial/relationship-attributes/define-relationships-attributes.md
1 parent 893f8bd commit 240b9a3

File tree

1 file changed

+3
-153
lines changed

1 file changed

+3
-153
lines changed

‎docs/tutorial/relationship-attributes/define-relationships-attributes.md‎

Lines changed: 3 additions & 153 deletions
Original file line numberDiff line numberDiff line change
@@ -41,169 +41,19 @@ Now that you know how these tables work underneath and how the model classes rep
4141

4242
Up to now, we have only used the `team_id` column to connect the tables when querying with `select()`:
4343

44-
//// tab | Python 3.10+
45-
46-
```Python hl_lines="16"
47-
{!./docs_src/tutorial/connect/insert/tutorial001_py310.py[ln:1-16]!}
48-
49-
# Code below omitted 👇
50-
```
51-
52-
////
53-
54-
//// tab | Python 3.7+
55-
56-
```Python hl_lines="18"
57-
{!./docs_src/tutorial/connect/insert/tutorial001.py[ln:1-18]!}
58-
59-
# Code below omitted 👇
60-
```
61-
62-
////
63-
64-
/// details | đź‘€ Full file preview
65-
66-
//// tab | Python 3.10+
67-
68-
```Python
69-
{!./docs_src/tutorial/connect/insert/tutorial001_py310.py!}
70-
```
71-
72-
////
73-
74-
//// tab | Python 3.7+
75-
76-
```Python
77-
{!./docs_src/tutorial/connect/insert/tutorial001.py!}
78-
```
79-
80-
////
81-
82-
///
44+
{* ./docs_src/tutorial/connect/insert/tutorial001_py310.py ln[1:16] hl[16] *}
8345

8446
This is a **plain field** like all the others, all representing a **column in the table**.
8547

8648
But now let's add a couple of new special attributes to these model classes, let's add `Relationship` attributes.
8749

8850
First, import `Relationship` from `sqlmodel`:
8951

90-
//// tab | Python 3.10+
91-
92-
```Python hl_lines="1"
93-
{!./docs_src/tutorial/relationship_attributes/define_relationship_attributes/tutorial001_py310.py[ln:1]!}
94-
95-
# Code below omitted 👇
96-
```
97-
98-
////
99-
100-
//// tab | Python 3.9+
101-
102-
```Python hl_lines="3"
103-
{!./docs_src/tutorial/relationship_attributes/define_relationship_attributes/tutorial001_py39.py[ln:1-3]!}
104-
105-
# Code below omitted 👇
106-
```
107-
108-
////
109-
110-
//// tab | Python 3.7+
111-
112-
```Python hl_lines="3"
113-
{!./docs_src/tutorial/relationship_attributes/define_relationship_attributes/tutorial001.py[ln:1-3]!}
114-
115-
# Code below omitted 👇
116-
```
117-
118-
////
119-
120-
/// details | đź‘€ Full file preview
121-
122-
//// tab | Python 3.10+
123-
124-
```Python
125-
{!./docs_src/tutorial/relationship_attributes/define_relationship_attributes/tutorial001_py310.py!}
126-
```
127-
128-
////
129-
130-
//// tab | Python 3.9+
131-
132-
```Python
133-
{!./docs_src/tutorial/relationship_attributes/define_relationship_attributes/tutorial001_py39.py!}
134-
```
135-
136-
////
137-
138-
//// tab | Python 3.7+
139-
140-
```Python
141-
{!./docs_src/tutorial/relationship_attributes/define_relationship_attributes/tutorial001.py!}
142-
```
143-
144-
////
145-
146-
///
52+
{* ./docs_src/tutorial/relationship_attributes/define_relationship_attributes/tutorial001_py310.py ln[1] hl[1] *}
14753

14854
Next, use that `Relationship` to declare a new attribute in the model classes:
14955

150-
//// tab | Python 3.10+
151-
152-
```Python hl_lines="9 19"
153-
{!./docs_src/tutorial/relationship_attributes/define_relationship_attributes/tutorial001_py310.py[ln:1-19]!}
154-
155-
# Code below omitted 👇
156-
```
157-
158-
////
159-
160-
//// tab | Python 3.9+
161-
162-
```Python hl_lines="11 21"
163-
{!./docs_src/tutorial/relationship_attributes/define_relationship_attributes/tutorial001_py39.py[ln:1-21]!}
164-
165-
# Code below omitted 👇
166-
```
167-
168-
////
169-
170-
//// tab | Python 3.7+
171-
172-
```Python hl_lines="11 21"
173-
{!./docs_src/tutorial/relationship_attributes/define_relationship_attributes/tutorial001.py[ln:1-21]!}
174-
175-
# Code below omitted 👇
176-
```
177-
178-
////
179-
180-
/// details | đź‘€ Full file preview
181-
182-
//// tab | Python 3.10+
183-
184-
```Python
185-
{!./docs_src/tutorial/relationship_attributes/define_relationship_attributes/tutorial001_py310.py!}
186-
```
187-
188-
////
189-
190-
//// tab | Python 3.9+
191-
192-
```Python
193-
{!./docs_src/tutorial/relationship_attributes/define_relationship_attributes/tutorial001_py39.py!}
194-
```
195-
196-
////
197-
198-
//// tab | Python 3.7+
199-
200-
```Python
201-
{!./docs_src/tutorial/relationship_attributes/define_relationship_attributes/tutorial001.py!}
202-
```
203-
204-
////
205-
206-
///
56+
{* ./docs_src/tutorial/relationship_attributes/define_relationship_attributes/tutorial001_py310.py ln[1:19] hl[9,19] *}
20757

20858
## What Are These Relationship Attributes
20959

0 commit comments

Comments
 (0)