@@ -57,45 +57,7 @@ Let's start by creating the tables in code.
5757
5858Import the things we need from ` sqlmodel ` and create a new ` Team ` model:
5959
60- //// tab | Python 3.10+
61-
62- ``` Python hl_lines="4-7"
63- {!./ docs_src/ tutorial/ connect/ create_tables/ tutorial001_py310.py[ln:1 - 7 ]!}
64-
65- # Code below omitted 👇
66- ```
67-
68- ////
69-
70- //// tab | Python 3.7+
71-
72- ``` Python hl_lines="6-9"
73- {!./ docs_src/ tutorial/ connect/ create_tables/ tutorial001.py[ln:1 - 9 ]!}
74-
75- # Code below omitted 👇
76- ```
77-
78- ////
79-
80- /// details | 👀 Full file preview
81-
82- //// tab | Python 3.10+
83-
84- ``` Python
85- {!./ docs_src/ tutorial/ connect/ create_tables/ tutorial001_py310.py!}
86- ```
87-
88- ////
89-
90- //// tab | Python 3.7+
91-
92- ``` Python
93- {!./ docs_src/ tutorial/ connect/ create_tables/ tutorial001.py!}
94- ```
95-
96- ////
97-
98- ///
60+ {* ./docs_src/tutorial/connect/create_tables/tutorial001_py310.py ln[ 1:7] hl[ 4:7] * }
9961
10062This is very similar to what we have been doing with the ` Hero ` model.
10163
@@ -114,45 +76,7 @@ Now let's create the `hero` table.
11476
11577This is the same model we have been using up to now, we are just adding the new column ` team_id ` :
11678
117- //// tab | Python 3.10+
118-
119- ``` Python hl_lines="16"
120- {!./ docs_src/ tutorial/ connect/ create_tables/ tutorial001_py310.py[ln:1 - 16 ]!}
121-
122- # Code below omitted 👇
123- ```
124-
125- ////
126-
127- //// tab | Python 3.7+
128-
129- ``` Python hl_lines="18"
130- {!./ docs_src/ tutorial/ connect/ create_tables/ tutorial001.py[ln:1 - 18 ]!}
131-
132- # Code below omitted 👇
133- ```
134-
135- ////
136-
137- /// details | 👀 Full file preview
138-
139- //// tab | Python 3.10+
140-
141- ``` Python
142- {!./ docs_src/ tutorial/ connect/ create_tables/ tutorial001_py310.py!}
143- ```
144-
145- ////
146-
147- //// tab | Python 3.7+
148-
149- ``` Python
150- {!./ docs_src/ tutorial/ connect/ create_tables/ tutorial001.py!}
151- ```
152-
153- ////
154-
155- ///
79+ {* ./docs_src/tutorial/connect/create_tables/tutorial001_py310.py ln[ 1:16] hl[ 16] * }
15680
15781Most of that should look familiar:
15882
@@ -186,87 +110,11 @@ You can learn about setting a custom table name for a model in the Advanced User
186110
187111Now we can add the same code as before to create the engine and the function to create the tables:
188112
189- //// tab | Python 3.10+
190-
191- ``` Python hl_lines="3-4 6 9-10"
192- # Code above omitted 👆
193-
194- {!./ docs_src/ tutorial/ connect/ create_tables/ tutorial001_py310.py[ln:19 - 26 ]!}
195- ```
196-
197- ////
198-
199- //// tab | Python 3.7+
200-
201- ``` Python hl_lines="3-4 6 9-10"
202- # Code above omitted 👆
203-
204- {!./ docs_src/ tutorial/ connect/ create_tables/ tutorial001.py[ln:21 - 28 ]!}
205- ```
206-
207- ////
208-
209- /// details | 👀 Full file preview
210-
211- //// tab | Python 3.10+
212-
213- ``` Python
214- {!./ docs_src/ tutorial/ connect/ create_tables/ tutorial001_py310.py!}
215- ```
216-
217- ////
218-
219- //// tab | Python 3.7+
220-
221- ``` Python
222- {!./ docs_src/ tutorial/ connect/ create_tables/ tutorial001.py!}
223- ```
224-
225- ////
226-
227- ///
113+ {* ./docs_src/tutorial/connect/create_tables/tutorial001_py310.py ln[ 19:26] hl[ 19:20,22,25:26] * }
228114
229115And as before, we'll call this function from another function ` main() ` , and we'll add that function ` main() ` to the main block of the file:
230116
231- //// tab | Python 3.10+
232-
233- ``` Python hl_lines="3-4 7-8"
234- # Code above omitted 👆
235-
236- {!./ docs_src/ tutorial/ connect/ create_tables/ tutorial001_py310.py[ln:29 - 34 ]!}
237- ```
238-
239- ////
240-
241- //// tab | Python 3.7+
242-
243- ``` Python hl_lines="3-4 7-8"
244- # Code above omitted 👆
245-
246- {!./ docs_src/ tutorial/ connect/ create_tables/ tutorial001.py[ln:31 - 36 ]!}
247- ```
248-
249- ////
250-
251- /// details | 👀 Full file preview
252-
253- //// tab | Python 3.10+
254-
255- ``` Python
256- {!./ docs_src/ tutorial/ connect/ create_tables/ tutorial001_py310.py!}
257- ```
258-
259- ////
260-
261- //// tab | Python 3.7+
262-
263- ``` Python
264- {!./ docs_src/ tutorial/ connect/ create_tables/ tutorial001.py!}
265- ```
266-
267- ////
268-
269- ///
117+ {* ./docs_src/tutorial/connect/create_tables/tutorial001_py310.py ln[ 29:34] hl[ 29:30,33:34] * }
270118
271119## Run the Code
272120
0 commit comments