FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

📝 Hide formatting guards in HTML comments by tiangolo · Pull Request #2115 · fastapi/sqlmodel · GitHub

Repository navigation

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .md  (1) All 1 file type selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
8 changes: 4 additions & 4 deletions docs/db-to-code.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
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

Back | FazBrowse Home | New Git URL