diff --git a/docs/db-to-code.md b/docs/db-to-code.md index 4b24bd1bb3..56e468c987 100644 --- a/docs/db-to-code.md +++ b/docs/db-to-code.md @@ -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: + ```Python user_id = input("Type the user ID: ") -# fmt: off session.exec( select(Hero).where(Hero.id == user_id) ).all() -# fmt: on ``` + If the user provides this ID: @@ -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: + ```Python -# fmt: off database.execute( select(Hero).where(Hero.secret_name == "Dive Wilson") ).all() -# fmt: on ``` + ![](img/db-to-code/autocompletion01.png){class="shadow"}