Skip to content

Commit c877ad6

Browse files
committed
🔀 Merge branch 'main' into python39-310-examples
2 parents b2e56f3 + 2b0dfb5 commit c877ad6

38 files changed

+414
-614
lines changed

Diff for: docs/advanced/decimal.md

+6-9
Original file line numberDiff line numberDiff line change
@@ -47,14 +47,13 @@ Let's say that each hero in the database will have an amount of money. We could
4747
# More code here later 👇
4848
```
4949

50-
<details>
51-
<summary>👀 Full file preview</summary>
50+
/// details | 👀 Full file preview
5251

5352
```Python
5453
{!./docs_src/advanced/decimal/tutorial001.py!}
5554
```
5655

57-
</details>
56+
///
5857

5958
Here we are saying that `money` can have at most `5` digits with `max_digits`, **this includes the integers** (to the left of the decimal dot) **and the decimals** (to the right of the decimal dot).
6059

@@ -96,14 +95,13 @@ When creating new models you can actually pass normal (`float`) numbers, Pydanti
9695
# Code below omitted 👇
9796
```
9897

99-
<details>
100-
<summary>👀 Full file preview</summary>
98+
/// details | 👀 Full file preview
10199

102100
```Python
103101
{!./docs_src/advanced/decimal/tutorial001.py!}
104102
```
105103

106-
</details>
104+
///
107105

108106
## Select Decimal data
109107

@@ -117,14 +115,13 @@ Then, when working with Decimal types, you can confirm that they indeed avoid th
117115
# Code below omitted 👇
118116
```
119117

120-
<details>
121-
<summary>👀 Full file preview</summary>
118+
/// details | 👀 Full file preview
122119

123120
```Python
124121
{!./docs_src/advanced/decimal/tutorial001.py!}
125122
```
126123

127-
</details>
124+
///
128125

129126
## Review the results
130127

Diff for: docs/release-notes.md

+5
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
## Latest Changes
44

5+
* 🔧 Update config with new pymdown extensions. PR [#712](https://github.com/tiangolo/sqlmodel/pull/712) by [@tiangolo](https://github.com/tiangolo).
56
* 🙈 Update gitignore, include all coverage files. PR [#711](https://github.com/tiangolo/sqlmodel/pull/711) by [@tiangolo](https://github.com/tiangolo).
67

78
### Refactors
@@ -12,6 +13,10 @@
1213

1314
* ⬆️ Add support for Python 3.11 and Python 3.12. PR [#710](https://github.com/tiangolo/sqlmodel/pull/710) by [@tiangolo](https://github.com/tiangolo).
1415

16+
### Internal
17+
18+
* 📝 Update details syntax with new pymdown extensions format. PR [#713](https://github.com/tiangolo/sqlmodel/pull/713) by [@tiangolo](https://github.com/tiangolo).
19+
1520
## 0.0.12
1621

1722
### Features

Diff for: docs/tutorial/automatic-id-none-refresh.md

+16-24
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,13 @@ But the same `id` field actually **can be `None`** in the Python code, so we dec
1414
# Code below omitted 👇
1515
```
1616

17-
<details>
18-
<summary>👀 Full file preview</summary>
17+
/// details | 👀 Full file preview
1918

2019
```Python
2120
{!./docs_src/tutorial/automatic_id_none_refresh/tutorial001.py!}
2221
```
2322

24-
</details>
23+
///
2524

2625
Next, I'll show you a bit more about the synchronization of data between the database and the Python code.
2726

@@ -39,14 +38,13 @@ When we create a new `Hero` instance, we don't set the `id`:
3938
# Code below omitted 👇
4039
```
4140

42-
<details>
43-
<summary>👀 Full file preview</summary>
41+
/// details | 👀 Full file preview
4442

4543
```Python
4644
{!./docs_src/tutorial/automatic_id_none_refresh/tutorial001.py!}
4745
```
4846

49-
</details>
47+
///
5048

5149
### How `Optional` Helps
5250

@@ -82,14 +80,13 @@ We can confirm that by printing our heroes before adding them to the database:
8280
# Code below omitted 👇
8381
```
8482

85-
<details>
86-
<summary>👀 Full file preview</summary>
83+
/// details | 👀 Full file preview
8784

8885
```Python
8986
{!./docs_src/tutorial/automatic_id_none_refresh/tutorial001.py!}
9087
```
9188

92-
</details>
89+
///
9390

9491
That will output:
9592

@@ -128,14 +125,13 @@ We can verify by creating a session using a `with` block and adding the objects.
128125
# Code below omitted 👇
129126
```
130127

131-
<details>
132-
<summary>👀 Full file preview</summary>
128+
/// details | 👀 Full file preview
133129

134130
```Python
135131
{!./docs_src/tutorial/automatic_id_none_refresh/tutorial001.py!}
136132
```
137133

138-
</details>
134+
///
139135

140136
This will, again, output the `id`s of the objects as `None`:
141137

@@ -168,14 +164,13 @@ Then we can `commit` the changes in the session, and print again:
168164
# Code below omitted 👇
169165
```
170166

171-
<details>
172-
<summary>👀 Full file preview</summary>
167+
/// details | 👀 Full file preview
173168

174169
```Python
175170
{!./docs_src/tutorial/automatic_id_none_refresh/tutorial001.py!}
176171
```
177172

178-
</details>
173+
///
179174

180175
And now, something unexpected happens, look at the output, it seems as if the `Hero` instance objects had no data at all:
181176

@@ -241,14 +236,13 @@ To confirm and understand how this **automatic expiration and refresh** of data
241236
# Code below omitted 👇
242237
```
243238

244-
<details>
245-
<summary>👀 Full file preview</summary>
239+
/// details | 👀 Full file preview
246240

247241
```Python
248242
{!./docs_src/tutorial/automatic_id_none_refresh/tutorial001.py!}
249243
```
250244

251-
</details>
245+
///
252246

253247
Now we are actually accessing the attributes, because instead of printing the whole object `hero_1`:
254248

@@ -338,14 +332,13 @@ You can do that too with `session.refresh(object)`:
338332
# Code below omitted 👇
339333
```
340334

341-
<details>
342-
<summary>👀 Full file preview</summary>
335+
/// details | 👀 Full file preview
343336

344337
```Python
345338
{!./docs_src/tutorial/automatic_id_none_refresh/tutorial001.py!}
346339
```
347340

348-
</details>
341+
///
349342

350343
When Python executes this code:
351344

@@ -411,14 +404,13 @@ There are no surprises here, it still works:
411404
# Code below omitted 👇
412405
```
413406

414-
<details>
415-
<summary>👀 Full file preview</summary>
407+
/// details | 👀 Full file preview
416408

417409
```Python
418410
{!./docs_src/tutorial/automatic_id_none_refresh/tutorial001.py!}
419411
```
420412

421-
</details>
413+
///
422414

423415
And the output shows again the same data:
424416

Diff for: docs/tutorial/connect/create-connected-rows.md

+12-18
Original file line numberDiff line numberDiff line change
@@ -45,14 +45,13 @@ We will later update **Spider-Boy** to add him to the **Preventers** team too, b
4545

4646
We will continue with the code in the previous example and we will add more things to it.
4747

48-
<details>
49-
<summary>👀 Full file preview</summary>
48+
/// details | 👀 Full file preview
5049

5150
```Python
5251
{!./docs_src/tutorial/connect/create_tables/tutorial001.py!}
5352
```
5453

55-
</details>
54+
///
5655

5756
Make sure you remove the `database.db` file before running the examples to get the same results.
5857

@@ -72,14 +71,13 @@ Let's start by creating two teams:
7271
# Code below omitted 👇
7372
```
7473

75-
<details>
76-
<summary>👀 Full file preview</summary>
74+
/// details | 👀 Full file preview
7775

7876
```Python
7977
{!./docs_src/tutorial/connect/insert/tutorial001.py!}
8078
```
8179

82-
</details>
80+
///
8381

8482
This would hopefully look already familiar.
8583

@@ -103,14 +101,13 @@ Let's not forget to add this function `create_heroes()` to the `main()` function
103101
# Code below omitted 👇
104102
```
105103

106-
<details>
107-
<summary>👀 Full file preview</summary>
104+
/// details | 👀 Full file preview
108105

109106
```Python
110107
{!./docs_src/tutorial/connect/insert/tutorial001.py!}
111108
```
112109

113-
</details>
110+
///
114111

115112
## Run it
116113

@@ -151,14 +148,13 @@ As the `Hero` class model now has a field (column, attribute) `team_id`, we can
151148
# Code below omitted 👇
152149
```
153150

154-
<details>
155-
<summary>👀 Full file preview</summary>
151+
/// details | 👀 Full file preview
156152

157153
```Python
158154
{!./docs_src/tutorial/connect/insert/tutorial001.py!}
159155
```
160156

161-
</details>
157+
///
162158

163159
We haven't committed this hero to the database yet, but there are already a couple of things to pay **attention** to.
164160

@@ -190,14 +186,13 @@ Let's now create two more heroes:
190186
# Code below omitted 👇
191187
```
192188

193-
<details>
194-
<summary>👀 Full file preview</summary>
189+
/// details | 👀 Full file preview
195190

196191
```Python
197192
{!./docs_src/tutorial/connect/insert/tutorial001.py!}
198193
```
199194

200-
</details>
195+
///
201196

202197
When creating `hero_rusty_man`, we are accessing `team_preventers.id`, so that will also trigger a refresh of its data, generating an output of:
203198

@@ -236,14 +231,13 @@ Now let's refresh and print those new heroes to see their new ID pointing to the
236231
# Code below omitted 👇
237232
```
238233

239-
<details>
240-
<summary>👀 Full file preview</summary>
234+
/// details | 👀 Full file preview
241235

242236
```Python
243237
{!./docs_src/tutorial/connect/insert/tutorial001.py!}
244238
```
245239

246-
</details>
240+
///
247241

248242

249243
If we execute that in the command line, it will output:

Diff for: docs/tutorial/connect/create-connected-tables.md

+8-12
Original file line numberDiff line numberDiff line change
@@ -63,14 +63,13 @@ Import the things we need from `sqlmodel` and create a new `Team` model:
6363
# Code below omitted 👇
6464
```
6565

66-
<details>
67-
<summary>👀 Full file preview</summary>
66+
/// details | 👀 Full file preview
6867

6968
```Python
7069
{!./docs_src/tutorial/connect/create_tables/tutorial001.py!}
7170
```
7271

73-
</details>
72+
///
7473

7574
This is very similar to what we have been doing with the `Hero` model.
7675

@@ -95,14 +94,13 @@ This is the same model we have been using up to now, we are just adding the new
9594
# Code below omitted 👇
9695
```
9796

98-
<details>
99-
<summary>👀 Full file preview</summary>
97+
/// details | 👀 Full file preview
10098

10199
```Python
102100
{!./docs_src/tutorial/connect/create_tables/tutorial001.py!}
103101
```
104102

105-
</details>
103+
///
106104

107105
Most of that should look familiar:
108106

@@ -142,14 +140,13 @@ Now we can add the same code as before to create the engine and the function to
142140
{!./docs_src/tutorial/connect/create_tables/tutorial001.py[ln:21-28]!}
143141
```
144142

145-
<details>
146-
<summary>👀 Full file preview</summary>
143+
/// details | 👀 Full file preview
147144

148145
```Python
149146
{!./docs_src/tutorial/connect/create_tables/tutorial001.py!}
150147
```
151148

152-
</details>
149+
///
153150

154151
And 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:
155152

@@ -159,14 +156,13 @@ And as before, we'll call this function from another function `main()`, and we'l
159156
{!./docs_src/tutorial/connect/create_tables/tutorial001.py[ln:31-36]!}
160157
```
161158

162-
<details>
163-
<summary>👀 Full file preview</summary>
159+
/// details | 👀 Full file preview
164160

165161
```Python
166162
{!./docs_src/tutorial/connect/create_tables/tutorial001.py!}
167163
```
168164

169-
</details>
165+
///
170166

171167
## Run the Code
172168

0 commit comments

Comments
 (0)