From: Yurii Motov Date: Thu, 25 Dec 2025 10:50:55 +0000 (+0100) Subject: Update `tutorial003.md` annotations for Python 3.10+ X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=03e7be2016bb5d026441bb1507d6d67fa228d509;p=thirdparty%2Ffastapi%2Fsqlmodel.git Update `tutorial003.md` annotations for Python 3.10+ --- diff --git a/docs_src/tutorial/create_db_and_table/annotations/en/tutorial003.md b/docs_src/tutorial/create_db_and_table/annotations/en/tutorial003.md index f20779a5..81b548b5 100644 --- a/docs_src/tutorial/create_db_and_table/annotations/en/tutorial003.md +++ b/docs_src/tutorial/create_db_and_table/annotations/en/tutorial003.md @@ -6,7 +6,7 @@ 4. Create the `id` field: - It could be `None` until the database assigns a value to it, so we annotate it with `Optional`. + It could be `None` until the database assigns a value to it, so we annotate it with `Optional` (`int | None` in Python 3.10+). It is a **primary key**, so we use `Field()` and the argument `primary_key=True`. @@ -24,7 +24,7 @@ In the database, the default value will be `NULL`, the SQL equivalent of `None`. - As this field could be `None` (and `NULL` in the database), we annotate it with `Optional`. + As this field could be `None` (and `NULL` in the database), we annotate it with `Optional` (`int | None` in Python 3.10+). 8. Write the name of the database file. 9. Use the name of the database file to create the database URL.