Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions docs/db-to-code.md
Original file line number Diff line number Diff line change
Expand Up @@ -129,15 +129,15 @@ With **SQLModel**, instead of writing SQL statements directly, you use Python cl

For example, you could ask the database for the same hero with ID `2` with this code:

<!-- fmt:off -->
```Python
user_id = input("Type the user ID: ")

# fmt: off
session.exec(
select(Hero).where(Hero.id == user_id)
).all()
# fmt: on
```
<!-- fmt:on -->

If the user provides this ID:

Expand Down Expand Up @@ -232,13 +232,13 @@ results = database.execute(statement)

But if you use common Python classes and objects, your editor will be able to help you:

<!-- fmt:off -->
```Python
# fmt: off
database.execute(
select(Hero).where(Hero.secret_name == "Dive Wilson")
).all()
# fmt: on
```
<!-- fmt:on -->

![](img/db-to-code/autocompletion01.png){class="shadow"}

Expand Down
Loading