Skip to content

Commit bf882be

Browse files
authored
Update formatting of code include block and warning block
1 parent 06e0471 commit bf882be

File tree

1 file changed

+4
-12
lines changed

1 file changed

+4
-12
lines changed

docs/advanced/sa-column.md

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,27 +10,19 @@ Two ways of implementing `created_at` timestamps with Pydantic are [default fact
1010

1111
The SQLAlchemy docs describe how `created_at` timestamps can be automatically set with either [default](https://docs.sqlalchemy.org/en/14/core/defaults.html#python-executed-functions) or [server-default](https://docs.sqlalchemy.org/en/14/core/defaults.html#server-invoked-ddl-explicit-default-expressions) functions, by using `sa_column=Column(...)` as described in the SQLAlchemy documentation we can achieve the same behaviour:
1212

13-
```{.python .annotate hl_lines="8 12"}
14-
{!./docs_src/advanced/sa_column/tutorial001.py[ln:9-21]!}
15-
```
13+
{* ./docs_src/advanced/sa_column/tutorial001.py ln[9:21] hl[16,20] *}
1614

1715
Above we are saying that the `registered_at` column should have a `server_default` value of `func.now()` (see full code for imports), which means that if there is no provided value then the current time will be the recorded value for that row.
1816

1917
As there is a value there now, then it will not be changed automatically in the future.
2018

2119
The `updated_at` column has an `onupdate` value of `func.now()`, this means that each time an `UPDATE` is performed, the function will be executed, meaning that the timestamp changes whenever a change is made to the row.
2220

23-
!!! warning
24-
The difference between client-side python functions, server-side ddl expressions, and server-side implicit defaults is important in some situations but too in-depth to go into here. Check the SQL and SQLAlchemy docs for more information.
25-
26-
<details>
27-
<summary>👀 Full file preview</summary>
21+
/// warning
2822

29-
```Python
30-
{!./docs_src/advanced/sa_column/tutorial001.py!}
31-
```
23+
The difference between client-side python functions, server-side ddl expressions, and server-side implicit defaults is important in some situations but too in-depth to go into here. Check the SQL and SQLAlchemy docs for more information.
3224

33-
</details>
25+
///
3426

3527
### Pydantic Implementation
3628

0 commit comments

Comments
 (0)