From 2ebee74773560a673f93ccb0679736cd7850c54d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebasti=C3=A1n=20Ram=C3=ADrez?= Date: Mon, 9 Nov 2026 15:55:27 +0100 Subject: [PATCH 1/2] =?UTF-8?q?=E2=AC=86=EF=B8=8F=20Upgrade=20markdown-inc?= =?UTF-8?q?lude-variants=20to=200.0.10?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pyproject.toml | 2 +- uv.lock | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 6e32774796..7580f61d24 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -62,7 +62,7 @@ docs = [ "cairosvg >=2.9.0", "griffe-typingdoc >=0.3.0", "griffe-warnings-deprecated >=1.1.0", - "markdown-include-variants >=0.0.8", + "markdown-include-variants >=0.0.10", "mdx-include >=1.4.1", "mkdocstrings[python] >=1.0.3", "pillow >=12.1.1", diff --git a/uv.lock b/uv.lock index b7dc53e064..042014d4ff 100644 --- a/uv.lock +++ b/uv.lock @@ -766,14 +766,14 @@ wheels = [ [[package]] name = "markdown-include-variants" -version = "0.0.8" +version = "0.0.10" source = { registry = "https://pypi.org/simple" } dependencies = [ { name = "markdown" }, ] -sdist = { url = "https://files.pythonhosted.org/packages/c5/47/ec9eae4a6d2f336d95681df43720e2b25b045dc3ed44ae6d30a5ce2f5dff/markdown_include_variants-0.0.8.tar.gz", hash = "sha256:46d812340c64dcd3646b1eaa356bafb31626dd7b4955d15c44ff8c48c6357227", size = 46882, upload-time = "2025-12-12T16:11:04.254Z" } +sdist = { url = "https://files.pythonhosted.org/packages/ab/dc/429e70f873f8460ea0d21405032dfb5322192a9376f539aa5cc0ccb7d9de/markdown_include_variants-0.0.10.tar.gz", hash = "sha256:55b73051c2f825f85f274eebd3fecb0e099dd25ec12e488471ee349e734d0396", size = 62994, upload-time = "2026-11-08T16:42:10.799Z" } wheels = [ - { url = "https://files.pythonhosted.org/packages/4e/0e/130958e7ec50d13f2ee7b6c142df5c352520a9251baf1652e41262703857/markdown_include_variants-0.0.8-py3-none-any.whl", hash = "sha256:425a300ae25fbcd598506cba67859a9dfa047333e869e0ff2e11a5e354b326dc", size = 8120, upload-time = "2025-12-12T16:11:02.881Z" }, + { url = "https://files.pythonhosted.org/packages/50/55/bee38139f45ced70ce20d46cb18969602109bb14cb1c04c4749b3257dd2e/markdown_include_variants-0.0.10-py3-none-any.whl", hash = "sha256:fe889fd21ab85332814810108ae8b70ca1549818cfe349c3426025d9bc15855b", size = 8760, upload-time = "2026-11-08T16:42:09.337Z" }, ] [[package]] @@ -2052,7 +2052,7 @@ dev = [ { name = "griffe-warnings-deprecated", specifier = ">=1.1.0" }, { name = "httpx", specifier = ">=0.28.1" }, { name = "jinja2", specifier = ">=3.1.6" }, - { name = "markdown-include-variants", specifier = ">=0.0.8" }, + { name = "markdown-include-variants", specifier = ">=0.0.10" }, { name = "mdx-include", specifier = ">=1.4.1" }, { name = "mkdocstrings", extras = ["python"], specifier = ">=1.0.3" }, { name = "pillow", specifier = ">=12.1.1" }, @@ -2074,7 +2074,7 @@ docs = [ { name = "cairosvg", specifier = ">=2.9.0" }, { name = "griffe-typingdoc", specifier = ">=0.3.0" }, { name = "griffe-warnings-deprecated", specifier = ">=1.1.0" }, - { name = "markdown-include-variants", specifier = ">=0.0.8" }, + { name = "markdown-include-variants", specifier = ">=0.0.10" }, { name = "mdx-include", specifier = ">=1.4.1" }, { name = "mkdocstrings", extras = ["python"], specifier = ">=1.0.3" }, { name = "pillow", specifier = ">=12.1.1" }, From d2adb99f0a26f23c3342bfca98968e4b9eca67cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebasti=C3=A1n=20Ram=C3=ADrez?= Date: Mon, 9 Nov 2026 16:04:13 +0100 Subject: [PATCH 2/2] =?UTF-8?q?=F0=9F=93=9D=20Adopt=20unversioned=20docume?= =?UTF-8?q?ntation=20snippets?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/advanced/datetime.md | 10 ++--- docs/advanced/decimal.md | 6 +-- docs/advanced/uuid.md | 8 ++-- docs/tutorial/automatic-id-none-refresh.md | 22 +++++------ docs/tutorial/code-structure.md | 12 +++--- .../tutorial/connect/create-connected-rows.md | 12 +++--- .../connect/create-connected-tables.md | 8 ++-- docs/tutorial/connect/read-connected-data.md | 16 ++++---- .../connect/remove-data-connections.md | 4 +- .../connect/update-data-connections.md | 4 +- docs/tutorial/create-db-and-table.md | 28 ++++++-------- docs/tutorial/delete.md | 22 +++++------ docs/tutorial/fastapi/delete.md | 2 +- docs/tutorial/fastapi/limit-and-offset.md | 2 +- docs/tutorial/fastapi/multiple-models.md | 20 +++++----- docs/tutorial/fastapi/read-one.md | 6 +-- docs/tutorial/fastapi/relationships.md | 8 ++-- docs/tutorial/fastapi/response-model.md | 4 +- .../fastapi/session-with-dependency.md | 12 +++--- docs/tutorial/fastapi/simple-hero-api.md | 10 ++--- docs/tutorial/fastapi/teams.md | 8 ++-- docs/tutorial/fastapi/tests.md | 38 +++++++++---------- docs/tutorial/fastapi/update-extra-data.md | 10 ++--- docs/tutorial/fastapi/update.md | 10 ++--- docs/tutorial/indexes.md | 10 ++--- docs/tutorial/insert.md | 32 ++++++---------- docs/tutorial/limit-and-offset.md | 12 +++--- docs/tutorial/many-to-many/create-data.md | 8 ++-- .../many-to-many/create-models-with-link.md | 10 ++--- .../many-to-many/link-with-extra-fields.md | 12 +++--- .../update-remove-relationships.md | 10 ++--- docs/tutorial/one.md | 22 +++++------ .../relationship-attributes/back-populates.md | 22 +++++------ .../cascade-delete-relationships.md | 22 +++++------ .../create-and-update-relationships.md | 10 ++--- .../define-relationships-attributes.md | 6 +-- .../read-relationships.md | 8 ++-- .../remove-relationships.md | 4 +- .../type-annotation-strings.md | 2 +- docs/tutorial/select.md | 24 +++++------- docs/tutorial/update.md | 34 ++++++----------- docs/tutorial/where.md | 34 ++++++++--------- .../{tutorial002_py310.py => tutorial002.py} | 0 .../{tutorial003_py310.py => tutorial003.py} | 0 .../{tutorial004_py310.py => tutorial004.py} | 0 .../{tutorial005_py310.py => tutorial005.py} | 0 .../{tutorial001_py310.py => tutorial001.py} | 0 .../{tutorial001_py310.py => tutorial001.py} | 0 .../{tutorial002_py310.py => tutorial002.py} | 0 .../{tutorial001_py310.py => tutorial001.py} | 0 .../{tutorial002_py310.py => tutorial002.py} | 0 .../__init__.py | 0 .../{tutorial001_py310 => tutorial001}/app.py | 0 .../database.py | 0 .../models.py | 0 .../__init__.py | 0 .../{tutorial002_py310 => tutorial002}/app.py | 0 .../database.py | 0 .../hero_model.py | 0 .../team_model.py | 0 .../{tutorial001_py310.py => tutorial001.py} | 0 .../{tutorial001_py310.py => tutorial001.py} | 0 .../{tutorial001_py310.py => tutorial001.py} | 0 .../{tutorial001_py310.py => tutorial001.py} | 0 .../{tutorial002_py310.py => tutorial002.py} | 0 .../{tutorial003_py310.py => tutorial003.py} | 0 .../{tutorial004_py310.py => tutorial004.py} | 0 .../{tutorial005_py310.py => tutorial005.py} | 0 .../{tutorial001_py310.py => tutorial001.py} | 0 .../{tutorial001_py310.py => tutorial001.py} | 0 .../{tutorial002_py310.py => tutorial002.py} | 0 .../{tutorial003_py310.py => tutorial003.py} | 0 .../{tutorial001_py310.py => tutorial001.py} | 0 .../{tutorial002_py310.py => tutorial002.py} | 0 .../__init__.py | 0 .../annotations/en/test_main_001.md | 0 .../annotations/en/test_main_002.md | 0 .../annotations/en/test_main_003.md | 0 .../annotations/en/test_main_004.md | 0 .../annotations/en/test_main_005.md | 0 .../annotations/en/test_main_006.md | 0 .../main.py | 0 .../test_extra_coverage.py | 0 .../test_main.py | 0 .../test_main_001.py | 0 .../test_main_002.py | 0 .../test_main_003.py | 0 .../test_main_004.py | 0 .../test_main_005.py | 0 .../test_main_006.py | 0 .../{tutorial001_py310.py => tutorial001.py} | 0 .../{tutorial001_py310.py => tutorial001.py} | 0 .../{tutorial001_py310.py => tutorial001.py} | 0 .../{tutorial002_py310.py => tutorial002.py} | 0 .../{tutorial001_py310.py => tutorial001.py} | 0 .../{tutorial001_py310.py => tutorial001.py} | 0 .../{tutorial001_py310.py => tutorial001.py} | 0 .../{tutorial001_py310.py => tutorial001.py} | 0 .../{tutorial001_py310.py => tutorial001.py} | 0 .../{tutorial001_py310.py => tutorial001.py} | 0 .../{tutorial001_py310.py => tutorial001.py} | 0 .../{tutorial002_py310.py => tutorial002.py} | 0 .../{tutorial001_py310.py => tutorial001.py} | 0 .../{tutorial002_py310.py => tutorial002.py} | 0 .../{tutorial001_py310.py => tutorial001.py} | 0 .../{tutorial002_py310.py => tutorial002.py} | 0 .../{tutorial003_py310.py => tutorial003.py} | 0 .../{tutorial001_py310.py => tutorial001.py} | 0 .../{tutorial002_py310.py => tutorial002.py} | 0 .../{tutorial003_py310.py => tutorial003.py} | 0 .../{tutorial001_py310.py => tutorial001.py} | 0 .../{tutorial002_py310.py => tutorial002.py} | 0 .../{tutorial003_py310.py => tutorial003.py} | 0 .../{tutorial004_py310.py => tutorial004.py} | 0 .../{tutorial001_py310.py => tutorial001.py} | 0 .../{tutorial002_py310.py => tutorial002.py} | 0 .../{tutorial003_py310.py => tutorial003.py} | 0 .../{tutorial004_py310.py => tutorial004.py} | 0 .../{tutorial005_py310.py => tutorial005.py} | 0 .../{tutorial006_py310.py => tutorial006.py} | 0 .../{tutorial007_py310.py => tutorial007.py} | 0 .../{tutorial008_py310.py => tutorial008.py} | 0 .../{tutorial009_py310.py => tutorial009.py} | 0 .../{tutorial001_py310.py => tutorial001.py} | 0 .../{tutorial002_py310.py => tutorial002.py} | 0 .../{tutorial003_py310.py => tutorial003.py} | 0 .../{tutorial001_py310.py => tutorial001.py} | 0 .../{tutorial002_py310.py => tutorial002.py} | 0 .../{tutorial003_py310.py => tutorial003.py} | 0 .../{tutorial004_py310.py => tutorial004.py} | 0 .../{tutorial005_py310.py => tutorial005.py} | 0 .../{tutorial001_py310.py => tutorial001.py} | 0 .../{tutorial001_py310.py => tutorial001.py} | 0 .../{tutorial001_py310.py => tutorial001.py} | 0 .../{tutorial002_py310.py => tutorial002.py} | 0 .../{tutorial001_py310.py => tutorial001.py} | 0 .../{tutorial002_py310.py => tutorial002.py} | 0 .../{tutorial003_py310.py => tutorial003.py} | 0 .../{tutorial004_py310.py => tutorial004.py} | 0 .../{tutorial001_py310.py => tutorial001.py} | 0 .../{tutorial002_py310.py => tutorial002.py} | 0 .../{tutorial003_py310.py => tutorial003.py} | 0 .../{tutorial004_py310.py => tutorial004.py} | 0 .../{tutorial001_py310.py => tutorial001.py} | 0 .../{tutorial002_py310.py => tutorial002.py} | 0 .../{tutorial003_py310.py => tutorial003.py} | 0 .../{tutorial004_py310.py => tutorial004.py} | 0 .../{tutorial005_py310.py => tutorial005.py} | 0 .../{tutorial006_py310.py => tutorial006.py} | 0 ...{tutorial006b_py310.py => tutorial006b.py} | 0 .../{tutorial007_py310.py => tutorial007.py} | 0 .../{tutorial008_py310.py => tutorial008.py} | 0 .../{tutorial009_py310.py => tutorial009.py} | 0 .../{tutorial011_py310.py => tutorial011.py} | 0 .../test_datetime/test_tutorial002.py | 2 +- .../test_datetime/test_tutorial003.py | 2 +- .../test_datetime/test_tutorial004.py | 2 +- .../test_datetime/test_tutorial005.py | 2 +- .../test_decimal/test_tutorial001.py | 2 +- .../test_uuid/test_tutorial001.py | 2 +- .../test_uuid/test_tutorial002.py | 2 +- .../test_tutorial001_tutorial002.py | 4 +- .../test_code_structure/test_tutorial001.py | 2 +- .../test_code_structure/test_tutorial002.py | 2 +- .../test_tutorial001.py | 2 +- .../test_delete/test_tutorial001.py | 2 +- .../test_insert/test_tutorial001.py | 2 +- .../test_tutorial001_tutorial002.py | 4 +- .../test_select/test_tutorial003.py | 2 +- .../test_select/test_tutorial004.py | 2 +- .../test_select/test_tutorial005.py | 2 +- .../test_update/test_tutorial001.py | 2 +- .../test_tutorial001.py | 2 +- .../test_tutorial002.py | 2 +- .../test_tutorial003.py | 2 +- .../test_tutorial001_tutorial002.py | 4 +- .../test_tutorial001_tests001.py | 2 +- .../test_tutorial001_tests002.py | 2 +- .../test_tutorial001_tests003.py | 2 +- .../test_tutorial001_tests004.py | 2 +- .../test_tutorial001_tests005.py | 6 +-- .../test_tutorial001_tests006.py | 6 +-- .../test_tutorial001_tests_main.py | 2 +- .../test_delete/test_tutorial001.py | 2 +- .../test_limit_and_offset/test_tutorial001.py | 2 +- .../test_multiple_models/test_tutorial001.py | 2 +- .../test_multiple_models/test_tutorial002.py | 2 +- .../test_read_one/test_tutorial001.py | 2 +- .../test_relationships/test_tutorial001.py | 2 +- .../test_response_model/test_tutorial001.py | 2 +- .../test_tutorial001.py | 2 +- .../test_simple_hero_api/test_tutorial001.py | 2 +- .../test_teams/test_tutorial001.py | 2 +- .../test_update/test_tutorial001.py | 2 +- .../test_update/test_tutorial002.py | 2 +- .../test_indexes/test_tutorial001.py | 2 +- .../test_indexes/test_tutorial002.py | 2 +- .../test_insert/test_tutorial001.py | 2 +- .../test_insert/test_tutorial002.py | 2 +- .../test_insert/test_tutorial003.py | 2 +- .../test_limit_and_offset/test_tutorial001.py | 2 +- .../test_limit_and_offset/test_tutorial002.py | 2 +- .../test_limit_and_offset/test_tutorial003.py | 2 +- .../test_limit_and_offset/test_tutorial004.py | 2 +- .../test_many_to_many/test_tutorial001.py | 2 +- .../test_many_to_many/test_tutorial002.py | 2 +- .../test_many_to_many/test_tutorial003.py | 2 +- .../test_one/test_tutorial001.py | 2 +- .../test_one/test_tutorial002.py | 2 +- .../test_one/test_tutorial003.py | 2 +- .../test_one/test_tutorial004.py | 2 +- .../test_one/test_tutorial005.py | 2 +- .../test_one/test_tutorial006.py | 2 +- .../test_one/test_tutorial007.py | 2 +- .../test_one/test_tutorial008.py | 2 +- .../test_one/test_tutorial009.py | 2 +- .../test_back_populates/test_tutorial001.py | 2 +- .../test_back_populates/test_tutorial002.py | 2 +- .../test_back_populates/test_tutorial003.py | 2 +- .../test_tutorial001.py | 2 +- .../test_tutorial001.py | 2 +- .../test_tutorial001.py | 2 +- .../test_tutorial002.py | 2 +- .../test_tutorial003.py | 2 +- .../test_tutorial004.py | 2 +- .../test_tutorial005.py | 2 +- .../test_tutorial001.py | 2 +- .../test_tutorial002.py | 2 +- .../test_tutorial001_tutorial002.py | 4 +- .../test_tutorial003_tutorial004.py | 4 +- .../test_tutorial001_tutorial002.py | 4 +- .../test_tutorial003_tutorial004.py | 4 +- .../test_where/test_tutorial001.py | 2 +- .../test_where/test_tutorial002.py | 2 +- .../test_where/test_tutorial003.py | 2 +- .../test_where/test_tutorial004.py | 2 +- .../test_where/test_tutorial005.py | 2 +- .../test_where/test_tutorial006.py | 2 +- .../test_where/test_tutorial006b.py | 2 +- .../test_where/test_tutorial007.py | 2 +- .../test_where/test_tutorial008.py | 2 +- .../test_where/test_tutorial009.py | 2 +- .../test_where/test_tutorial011.py | 2 +- 243 files changed, 364 insertions(+), 400 deletions(-) rename docs_src/advanced/datetime/{tutorial002_py310.py => tutorial002.py} (100%) rename docs_src/advanced/datetime/{tutorial003_py310.py => tutorial003.py} (100%) rename docs_src/advanced/datetime/{tutorial004_py310.py => tutorial004.py} (100%) rename docs_src/advanced/datetime/{tutorial005_py310.py => tutorial005.py} (100%) rename docs_src/advanced/decimal/{tutorial001_py310.py => tutorial001.py} (100%) rename docs_src/advanced/uuid/{tutorial001_py310.py => tutorial001.py} (100%) rename docs_src/advanced/uuid/{tutorial002_py310.py => tutorial002.py} (100%) rename docs_src/tutorial/automatic_id_none_refresh/{tutorial001_py310.py => tutorial001.py} (100%) rename docs_src/tutorial/automatic_id_none_refresh/{tutorial002_py310.py => tutorial002.py} (100%) rename docs_src/tutorial/code_structure/{tutorial001_py310 => tutorial001}/__init__.py (100%) rename docs_src/tutorial/code_structure/{tutorial001_py310 => tutorial001}/app.py (100%) rename docs_src/tutorial/code_structure/{tutorial001_py310 => tutorial001}/database.py (100%) rename docs_src/tutorial/code_structure/{tutorial001_py310 => tutorial001}/models.py (100%) rename docs_src/tutorial/code_structure/{tutorial002_py310 => tutorial002}/__init__.py (100%) rename docs_src/tutorial/code_structure/{tutorial002_py310 => tutorial002}/app.py (100%) rename docs_src/tutorial/code_structure/{tutorial002_py310 => tutorial002}/database.py (100%) rename docs_src/tutorial/code_structure/{tutorial002_py310 => tutorial002}/hero_model.py (100%) rename docs_src/tutorial/code_structure/{tutorial002_py310 => tutorial002}/team_model.py (100%) rename docs_src/tutorial/connect/create_tables/{tutorial001_py310.py => tutorial001.py} (100%) rename docs_src/tutorial/connect/delete/{tutorial001_py310.py => tutorial001.py} (100%) rename docs_src/tutorial/connect/insert/{tutorial001_py310.py => tutorial001.py} (100%) rename docs_src/tutorial/connect/select/{tutorial001_py310.py => tutorial001.py} (100%) rename docs_src/tutorial/connect/select/{tutorial002_py310.py => tutorial002.py} (100%) rename docs_src/tutorial/connect/select/{tutorial003_py310.py => tutorial003.py} (100%) rename docs_src/tutorial/connect/select/{tutorial004_py310.py => tutorial004.py} (100%) rename docs_src/tutorial/connect/select/{tutorial005_py310.py => tutorial005.py} (100%) rename docs_src/tutorial/connect/update/{tutorial001_py310.py => tutorial001.py} (100%) rename docs_src/tutorial/create_db_and_table/{tutorial001_py310.py => tutorial001.py} (100%) rename docs_src/tutorial/create_db_and_table/{tutorial002_py310.py => tutorial002.py} (100%) rename docs_src/tutorial/create_db_and_table/{tutorial003_py310.py => tutorial003.py} (100%) rename docs_src/tutorial/delete/{tutorial001_py310.py => tutorial001.py} (100%) rename docs_src/tutorial/delete/{tutorial002_py310.py => tutorial002.py} (100%) rename docs_src/tutorial/fastapi/app_testing/{tutorial001_py310 => tutorial001}/__init__.py (100%) rename docs_src/tutorial/fastapi/app_testing/{tutorial001_py310 => tutorial001}/annotations/en/test_main_001.md (100%) rename docs_src/tutorial/fastapi/app_testing/{tutorial001_py310 => tutorial001}/annotations/en/test_main_002.md (100%) rename docs_src/tutorial/fastapi/app_testing/{tutorial001_py310 => tutorial001}/annotations/en/test_main_003.md (100%) rename docs_src/tutorial/fastapi/app_testing/{tutorial001_py310 => tutorial001}/annotations/en/test_main_004.md (100%) rename docs_src/tutorial/fastapi/app_testing/{tutorial001_py310 => tutorial001}/annotations/en/test_main_005.md (100%) rename docs_src/tutorial/fastapi/app_testing/{tutorial001_py310 => tutorial001}/annotations/en/test_main_006.md (100%) rename docs_src/tutorial/fastapi/app_testing/{tutorial001_py310 => tutorial001}/main.py (100%) rename docs_src/tutorial/fastapi/app_testing/{tutorial001_py310 => tutorial001}/test_extra_coverage.py (100%) rename docs_src/tutorial/fastapi/app_testing/{tutorial001_py310 => tutorial001}/test_main.py (100%) rename docs_src/tutorial/fastapi/app_testing/{tutorial001_py310 => tutorial001}/test_main_001.py (100%) rename docs_src/tutorial/fastapi/app_testing/{tutorial001_py310 => tutorial001}/test_main_002.py (100%) rename docs_src/tutorial/fastapi/app_testing/{tutorial001_py310 => tutorial001}/test_main_003.py (100%) rename docs_src/tutorial/fastapi/app_testing/{tutorial001_py310 => tutorial001}/test_main_004.py (100%) rename docs_src/tutorial/fastapi/app_testing/{tutorial001_py310 => tutorial001}/test_main_005.py (100%) rename docs_src/tutorial/fastapi/app_testing/{tutorial001_py310 => tutorial001}/test_main_006.py (100%) rename docs_src/tutorial/fastapi/delete/{tutorial001_py310.py => tutorial001.py} (100%) rename docs_src/tutorial/fastapi/limit_and_offset/{tutorial001_py310.py => tutorial001.py} (100%) rename docs_src/tutorial/fastapi/multiple_models/{tutorial001_py310.py => tutorial001.py} (100%) rename docs_src/tutorial/fastapi/multiple_models/{tutorial002_py310.py => tutorial002.py} (100%) rename docs_src/tutorial/fastapi/read_one/{tutorial001_py310.py => tutorial001.py} (100%) rename docs_src/tutorial/fastapi/relationships/{tutorial001_py310.py => tutorial001.py} (100%) rename docs_src/tutorial/fastapi/response_model/{tutorial001_py310.py => tutorial001.py} (100%) rename docs_src/tutorial/fastapi/session_with_dependency/{tutorial001_py310.py => tutorial001.py} (100%) rename docs_src/tutorial/fastapi/simple_hero_api/{tutorial001_py310.py => tutorial001.py} (100%) rename docs_src/tutorial/fastapi/teams/{tutorial001_py310.py => tutorial001.py} (100%) rename docs_src/tutorial/fastapi/update/{tutorial001_py310.py => tutorial001.py} (100%) rename docs_src/tutorial/fastapi/update/{tutorial002_py310.py => tutorial002.py} (100%) rename docs_src/tutorial/indexes/{tutorial001_py310.py => tutorial001.py} (100%) rename docs_src/tutorial/indexes/{tutorial002_py310.py => tutorial002.py} (100%) rename docs_src/tutorial/insert/{tutorial001_py310.py => tutorial001.py} (100%) rename docs_src/tutorial/insert/{tutorial002_py310.py => tutorial002.py} (100%) rename docs_src/tutorial/insert/{tutorial003_py310.py => tutorial003.py} (100%) rename docs_src/tutorial/many_to_many/{tutorial001_py310.py => tutorial001.py} (100%) rename docs_src/tutorial/many_to_many/{tutorial002_py310.py => tutorial002.py} (100%) rename docs_src/tutorial/many_to_many/{tutorial003_py310.py => tutorial003.py} (100%) rename docs_src/tutorial/offset_and_limit/{tutorial001_py310.py => tutorial001.py} (100%) rename docs_src/tutorial/offset_and_limit/{tutorial002_py310.py => tutorial002.py} (100%) rename docs_src/tutorial/offset_and_limit/{tutorial003_py310.py => tutorial003.py} (100%) rename docs_src/tutorial/offset_and_limit/{tutorial004_py310.py => tutorial004.py} (100%) rename docs_src/tutorial/one/{tutorial001_py310.py => tutorial001.py} (100%) rename docs_src/tutorial/one/{tutorial002_py310.py => tutorial002.py} (100%) rename docs_src/tutorial/one/{tutorial003_py310.py => tutorial003.py} (100%) rename docs_src/tutorial/one/{tutorial004_py310.py => tutorial004.py} (100%) rename docs_src/tutorial/one/{tutorial005_py310.py => tutorial005.py} (100%) rename docs_src/tutorial/one/{tutorial006_py310.py => tutorial006.py} (100%) rename docs_src/tutorial/one/{tutorial007_py310.py => tutorial007.py} (100%) rename docs_src/tutorial/one/{tutorial008_py310.py => tutorial008.py} (100%) rename docs_src/tutorial/one/{tutorial009_py310.py => tutorial009.py} (100%) rename docs_src/tutorial/relationship_attributes/back_populates/{tutorial001_py310.py => tutorial001.py} (100%) rename docs_src/tutorial/relationship_attributes/back_populates/{tutorial002_py310.py => tutorial002.py} (100%) rename docs_src/tutorial/relationship_attributes/back_populates/{tutorial003_py310.py => tutorial003.py} (100%) rename docs_src/tutorial/relationship_attributes/cascade_delete_relationships/{tutorial001_py310.py => tutorial001.py} (100%) rename docs_src/tutorial/relationship_attributes/cascade_delete_relationships/{tutorial002_py310.py => tutorial002.py} (100%) rename docs_src/tutorial/relationship_attributes/cascade_delete_relationships/{tutorial003_py310.py => tutorial003.py} (100%) rename docs_src/tutorial/relationship_attributes/cascade_delete_relationships/{tutorial004_py310.py => tutorial004.py} (100%) rename docs_src/tutorial/relationship_attributes/cascade_delete_relationships/{tutorial005_py310.py => tutorial005.py} (100%) rename docs_src/tutorial/relationship_attributes/create_and_update_relationships/{tutorial001_py310.py => tutorial001.py} (100%) rename docs_src/tutorial/relationship_attributes/define_relationship_attributes/{tutorial001_py310.py => tutorial001.py} (100%) rename docs_src/tutorial/relationship_attributes/read_relationships/{tutorial001_py310.py => tutorial001.py} (100%) rename docs_src/tutorial/relationship_attributes/read_relationships/{tutorial002_py310.py => tutorial002.py} (100%) rename docs_src/tutorial/select/{tutorial001_py310.py => tutorial001.py} (100%) rename docs_src/tutorial/select/{tutorial002_py310.py => tutorial002.py} (100%) rename docs_src/tutorial/select/{tutorial003_py310.py => tutorial003.py} (100%) rename docs_src/tutorial/select/{tutorial004_py310.py => tutorial004.py} (100%) rename docs_src/tutorial/update/{tutorial001_py310.py => tutorial001.py} (100%) rename docs_src/tutorial/update/{tutorial002_py310.py => tutorial002.py} (100%) rename docs_src/tutorial/update/{tutorial003_py310.py => tutorial003.py} (100%) rename docs_src/tutorial/update/{tutorial004_py310.py => tutorial004.py} (100%) rename docs_src/tutorial/where/{tutorial001_py310.py => tutorial001.py} (100%) rename docs_src/tutorial/where/{tutorial002_py310.py => tutorial002.py} (100%) rename docs_src/tutorial/where/{tutorial003_py310.py => tutorial003.py} (100%) rename docs_src/tutorial/where/{tutorial004_py310.py => tutorial004.py} (100%) rename docs_src/tutorial/where/{tutorial005_py310.py => tutorial005.py} (100%) rename docs_src/tutorial/where/{tutorial006_py310.py => tutorial006.py} (100%) rename docs_src/tutorial/where/{tutorial006b_py310.py => tutorial006b.py} (100%) rename docs_src/tutorial/where/{tutorial007_py310.py => tutorial007.py} (100%) rename docs_src/tutorial/where/{tutorial008_py310.py => tutorial008.py} (100%) rename docs_src/tutorial/where/{tutorial009_py310.py => tutorial009.py} (100%) rename docs_src/tutorial/where/{tutorial011_py310.py => tutorial011.py} (100%) diff --git a/docs/advanced/datetime.md b/docs/advanced/datetime.md index a67f9c0fd1..ffa081d64a 100644 --- a/docs/advanced/datetime.md +++ b/docs/advanced/datetime.md @@ -65,7 +65,7 @@ Pydantic provides [`AwareDatetime` and `NaiveDatetime`](https://docs.pydantic.de We can use them as field types: -{* ./docs_src/advanced/datetime/tutorial002_py310.py ln[1:8] hl[1,7:8] *} +{* ./docs_src/advanced/datetime/tutorial002.py ln[1:8] hl[1,7:8] *} Here, `starts_at` requires timezone information during validation. It uses the same database type as `datetime`: `UTCDateTime`. @@ -77,7 +77,7 @@ These types also work with `| None` and with `Annotated`, for example `Annotated We can use `Event.model_validate()` to validate the data before creating an event: -{* ./docs_src/advanced/datetime/tutorial002_py310.py ln[11:17] hl[13:14,16] *} +{* ./docs_src/advanced/datetime/tutorial002.py ln[11:17] hl[13:14,16] *} The `Z` at the end of `starts_at` means **UTC**. The value for `local_time` has no timezone, so both values pass validation. @@ -137,13 +137,13 @@ Back up the database and test schema changes, data conversions, and application Change the field annotation to `NaiveDatetime`: -{* ./docs_src/advanced/datetime/tutorial005_py310.py ln[1:9] hl[3,9] *} +{* ./docs_src/advanced/datetime/tutorial005.py ln[1:9] hl[3,9] *} This keeps the previous database column type, so no database migration is needed for that field. It also adds the validation constraint described above. To retain the previous database type **and** plain `datetime` validation behavior, declare the database type explicitly: -{* ./docs_src/advanced/datetime/tutorial003_py310.py ln[1:9] hl[3,9] *} +{* ./docs_src/advanced/datetime/tutorial003.py ln[1:9] hl[3,9] *} ### Adopt Timezone-Aware Storage on PostgreSQL @@ -153,7 +153,7 @@ To retain the previous database type **and** plain `datetime` validation behavio For example, if `event.created_at` contains naive **UTC** values, the operations in the generated revision can be: -{* ./docs_src/advanced/datetime/tutorial004_py310.py hl[9:11,19:21] *} +{* ./docs_src/advanced/datetime/tutorial004.py hl[9:11,19:21] *} This migration uses `sa.DateTime(timezone=True)`, the underlying database type of `UTCDateTime`. diff --git a/docs/advanced/decimal.md b/docs/advanced/decimal.md index 80330a59ab..3dca802a8f 100644 --- a/docs/advanced/decimal.md +++ b/docs/advanced/decimal.md @@ -33,7 +33,7 @@ For the database, **SQLModel** will use [SQLAlchemy's `DECIMAL` type](https://do Let's say that each hero in the database will have an amount of money. We can define that field as a `Decimal` and configure the maximum number of digits and decimal places using the parameters of `Field()`: -{* ./docs_src/advanced/decimal/tutorial001_py310.py ln[1:11] hl[11] *} +{* ./docs_src/advanced/decimal/tutorial001.py ln[1:11] hl[11] *} Here we are saying that `money` can have at most `5` digits with `max_digits`, **this includes the integers** (to the left of the decimal dot) **and the decimals** (to the right of the decimal dot). @@ -67,13 +67,13 @@ Make sure you adjust the number of digits and decimal places for your own needs, When creating new models you can actually pass normal (`float`) numbers, Pydantic will automatically convert them to `Decimal` types, and **SQLModel** will store them as `Decimal` types in the database (using SQLAlchemy). -{* ./docs_src/advanced/decimal/tutorial001_py310.py ln[24:34] hl[25:27] *} +{* ./docs_src/advanced/decimal/tutorial001.py ln[24:34] hl[25:27] *} ## Select Decimal data Then, when working with Decimal types, you can confirm that they indeed avoid those rounding errors from floats: -{* ./docs_src/advanced/decimal/tutorial001_py310.py ln[37:50] hl[49:50] *} +{* ./docs_src/advanced/decimal/tutorial001.py ln[37:50] hl[49:50] *} ## Review the results diff --git a/docs/advanced/uuid.md b/docs/advanced/uuid.md index c244f4403d..51f7b249a3 100644 --- a/docs/advanced/uuid.md +++ b/docs/advanced/uuid.md @@ -80,7 +80,7 @@ We don't call `uuid.uuid4()` ourselves in the code (we don't put the parenthesis This means that the UUID will be generated in the Python code, **before sending the data to the database**. -{* ./docs_src/advanced/uuid/tutorial001_py310.py ln[1:10] hl[1,7] *} +{* ./docs_src/advanced/uuid/tutorial001.py ln[1:10] hl[1,7] *} Pydantic has support for [`UUID` types](https://docs.pydantic.dev/latest/api/standard_library_types/#uuid). @@ -94,7 +94,7 @@ As `uuid.uuid4` will be called when creating the model instance, even before sen And that **same ID (a UUID)** will be saved in the database. -{* ./docs_src/advanced/uuid/tutorial001_py310.py ln[23:34] hl[25,27,29,34] *} +{* ./docs_src/advanced/uuid/tutorial001.py ln[23:34] hl[25,27,29,34] *} ### Select a Hero @@ -102,7 +102,7 @@ We can do the same operations we could do with other fields. For example we can **select a hero by ID**: -{* ./docs_src/advanced/uuid/tutorial001_py310.py ln[37:54] hl[49] *} +{* ./docs_src/advanced/uuid/tutorial001.py ln[37:54] hl[49] *} /// tip @@ -116,7 +116,7 @@ SQLModel (actually SQLAlchemy) will take care of making it work. ✨ We could also select by ID with `session.get()`: -{* ./docs_src/advanced/uuid/tutorial002_py310.py ln[37:53] hl[49] *} +{* ./docs_src/advanced/uuid/tutorial002.py ln[37:53] hl[49] *} The same way as with other fields, we could update, delete, etc. 🚀 diff --git a/docs/tutorial/automatic-id-none-refresh.md b/docs/tutorial/automatic-id-none-refresh.md index 11029f2d8e..0c80e03a09 100644 --- a/docs/tutorial/automatic-id-none-refresh.md +++ b/docs/tutorial/automatic-id-none-refresh.md @@ -6,7 +6,7 @@ Now let's talk a bit about why the `id` field **can't be `NULL`** on the databas But the same `id` field actually **can be `None`** in the Python code, so we declare the type with `int | None`, and set the default value to `Field(default=None)`: -{* ./docs_src/tutorial/automatic_id_none_refresh/tutorial001_py310.py ln[4:8] hl[5] *} +{* ./docs_src/tutorial/automatic_id_none_refresh/tutorial001.py ln[4:8] hl[5] *} Next, I'll show you a bit more about the synchronization of data between the database and the Python code. @@ -16,7 +16,7 @@ When do we get an actual `int` from the database in that `id` field? Let's see a When we create a new `Hero` instance, we don't set the `id`: -{* ./docs_src/tutorial/automatic_id_none_refresh/tutorial001_py310.py ln[21:24] hl[21:24] *} +{* ./docs_src/tutorial/automatic_id_none_refresh/tutorial001.py ln[21:24] hl[21:24] *} ### How `int | None` Helps @@ -44,7 +44,7 @@ But by declaring it with `int | None`, the editor will help us to avoid writing We can confirm that by printing our heroes before adding them to the database: -{* ./docs_src/tutorial/automatic_id_none_refresh/tutorial001_py310.py ln[21:29] hl[27:29] *} +{* ./docs_src/tutorial/automatic_id_none_refresh/tutorial001.py ln[21:29] hl[27:29] *} That will output: @@ -75,7 +75,7 @@ After we add the `Hero` instance objects to the **session**, the IDs are *still* We can verify by creating a session using a `with` block and adding the objects. And then printing them again: -{* ./docs_src/tutorial/automatic_id_none_refresh/tutorial001_py310.py ln[21:39] hl[37:39] *} +{* ./docs_src/tutorial/automatic_id_none_refresh/tutorial001.py ln[21:39] hl[37:39] *} This will, again, output the `id`s of the objects as `None`: @@ -100,7 +100,7 @@ As we saw before, the **session** is smart and doesn't talk to the database ever Then we can `commit` the changes in the session, and print again: -{* ./docs_src/tutorial/automatic_id_none_refresh/tutorial001_py310.py ln[31:46] hl[41,44:46] *} +{* ./docs_src/tutorial/automatic_id_none_refresh/tutorial001.py ln[31:46] hl[41,44:46] *} And now, something unexpected happens, look at the output, it seems as if the `Hero` instance objects had no data at all: @@ -158,7 +158,7 @@ We didn't access the object's attributes, like `hero.name`. We only accessed the To confirm and understand how this **automatic expiration and refresh** of data when accessing attributes work, we can print some individual fields (instance attributes): -{* ./docs_src/tutorial/automatic_id_none_refresh/tutorial001_py310.py ln[31:56] hl[49:51,54:56] *} +{* ./docs_src/tutorial/automatic_id_none_refresh/tutorial001.py ln[31:56] hl[49:51,54:56] *} Now we are actually accessing the attributes, because instead of printing the whole object `hero_1`: @@ -239,7 +239,7 @@ But what if you want to **explicitly refresh** the data? You can do that too with `session.refresh(object)`: -{* ./docs_src/tutorial/automatic_id_none_refresh/tutorial001_py310.py ln[31:65] hl[58:60,63:65] *} +{* ./docs_src/tutorial/automatic_id_none_refresh/tutorial001.py ln[31:65] hl[58:60,63:65] *} When Python executes this code: @@ -297,7 +297,7 @@ Now, as a final experiment, we can also print data after the **session** is clos There are no surprises here, it still works: -{* ./docs_src/tutorial/automatic_id_none_refresh/tutorial001_py310.py ln[31:70] hl[68:70] *} +{* ./docs_src/tutorial/automatic_id_none_refresh/tutorial001.py ln[31:70] hl[68:70] *} And the output shows again the same data: @@ -332,16 +332,12 @@ And as we created the **engine** with `echo=True`, we can see the SQL statements /// -//// tab | Python 3.10+ - ```Python -{!./docs_src/tutorial/automatic_id_none_refresh/tutorial002_py310.py!} +{!./docs_src/tutorial/automatic_id_none_refresh/tutorial002.py!} ``` {!./docs_src/tutorial/automatic_id_none_refresh/annotations/en/tutorial002.md!} -//// - And here's all the output generated by running this program, all together:
diff --git a/docs/tutorial/code-structure.md b/docs/tutorial/code-structure.md index 55b5b181fb..09c05c1cdd 100644 --- a/docs/tutorial/code-structure.md +++ b/docs/tutorial/code-structure.md @@ -67,7 +67,7 @@ We can use these relative imports because, for example, in the file `app.py` (th You could put all the database Models in a single Python module (a single Python file), for example `models.py`: -{* ./docs_src/tutorial/code_structure/tutorial001_py310/models.py *} +{* ./docs_src/tutorial/code_structure/tutorial001/models.py *} This way, you wouldn't have to deal with circular imports for other models. @@ -77,7 +77,7 @@ And then you could import the models from this file/module in any other file/mod Then you could put the code creating the **engine** and the function to create all the tables (if you are not using migrations) in another file `database.py`: -{* ./docs_src/tutorial/code_structure/tutorial001_py310/database.py *} +{* ./docs_src/tutorial/code_structure/tutorial001/database.py *} This file would also be imported by your application code, to use the shared **engine** and to get and call the function `create_db_and_tables()`. @@ -85,7 +85,7 @@ This file would also be imported by your application code, to use the shared **e Finally, you could put the code to create the **app** in another file `app.py`: -{* ./docs_src/tutorial/code_structure/tutorial001_py310/app.py hl[3:4] *} +{* ./docs_src/tutorial/code_structure/tutorial001/app.py hl[3:4] *} Here we import the models, the engine, and the function to create all the tables and then we can use them all internally. @@ -201,7 +201,7 @@ So, we can use it in an `if` block and import things inside the `if` block. And Using that trick of `TYPE_CHECKING` we can "import" the `Team` in `hero_model.py`: -{* ./docs_src/tutorial/code_structure/tutorial002_py310/hero_model.py hl[1,5:6,16] *} +{* ./docs_src/tutorial/code_structure/tutorial002/hero_model.py hl[1,5:6,16] *} Keep in mind that now we *have* to put the annotation of `Team` as a string: `"Team"`, so that Python doesn't have errors at runtime. @@ -209,7 +209,7 @@ Keep in mind that now we *have* to put the annotation of `Team` as a string: `"T We use the same trick in the `team_model.py` file: -{* ./docs_src/tutorial/code_structure/tutorial002_py310/team_model.py hl[1,5:6,14] *} +{* ./docs_src/tutorial/code_structure/tutorial002/team_model.py hl[1,5:6,14] *} Now we get editor support, autocompletion, inline errors, and **SQLModel** keeps working. 🎉 @@ -217,7 +217,7 @@ Now we get editor support, autocompletion, inline errors, and **SQLModel** keeps Now, just for completeness, the `app.py` file would import the models from both modules: -{* ./docs_src/tutorial/code_structure/tutorial002_py310/app.py hl[4:5,10,12:14] *} +{* ./docs_src/tutorial/code_structure/tutorial002/app.py hl[4:5,10,12:14] *} And of course, all the tricks with `TYPE_CHECKING` and type annotations in strings are **only needed in the files with circular imports**. diff --git a/docs/tutorial/connect/create-connected-rows.md b/docs/tutorial/connect/create-connected-rows.md index ffcfd0a784..2e965ae273 100644 --- a/docs/tutorial/connect/create-connected-rows.md +++ b/docs/tutorial/connect/create-connected-rows.md @@ -45,7 +45,7 @@ We will later update **Spider-Boy** to add him to the **Preventers** team too, b We will continue with the code in the previous example and we will add more things to it. -{* ./docs_src/tutorial/connect/create_tables/tutorial001_py310.py ln[0] *} +{* ./docs_src/tutorial/connect/create_tables/tutorial001.py ln[0] *} Make sure you remove the `database.db` file before running the examples to get the same results. @@ -57,7 +57,7 @@ And now we will also create the teams there. 🎉 Let's start by creating two teams: -{* ./docs_src/tutorial/connect/insert/tutorial001_py310.py ln[29:35] hl[29:35] *} +{* ./docs_src/tutorial/connect/insert/tutorial001.py ln[29:35] hl[29:35] *} This would hopefully look already familiar. @@ -73,7 +73,7 @@ And finally we **commit** the session to save the changes to the database. Let's not forget to add this function `create_heroes()` to the `main()` function so that we run it when calling the program from the command line: -{* ./docs_src/tutorial/connect/insert/tutorial001_py310.py ln[61:63] hl[63] *} +{* ./docs_src/tutorial/connect/insert/tutorial001.py ln[61:63] hl[63] *} ## Run it @@ -106,7 +106,7 @@ Now let's create one hero object to start. As the `Hero` class model now has a field (column, attribute) `team_id`, we can set it by using the ID field from the `Team` objects we just created before: -{* ./docs_src/tutorial/connect/insert/tutorial001_py310.py ln[29:39] hl[38] *} +{* ./docs_src/tutorial/connect/insert/tutorial001.py ln[29:39] hl[38] *} We haven't committed this hero to the database yet, but there are already a couple of things to pay **attention** to. @@ -130,7 +130,7 @@ INFO Engine [generated in 0.00025s] (2,) Let's now create two more heroes: -{* ./docs_src/tutorial/connect/insert/tutorial001_py310.py ln[29:50] hl[40:46] *} +{* ./docs_src/tutorial/connect/insert/tutorial001.py ln[29:50] hl[40:46] *} When creating `hero_rusty_man`, we are accessing `team_preventers.id`, so that will also trigger a refresh of its data, generating an output of: @@ -161,7 +161,7 @@ INFO Engine COMMIT Now let's refresh and print those new heroes to see their new ID pointing to their teams: -{* ./docs_src/tutorial/connect/insert/tutorial001_py310.py ln[29:58] hl[52:54,56:58] *} +{* ./docs_src/tutorial/connect/insert/tutorial001.py ln[29:58] hl[52:54,56:58] *} If we execute that in the command line, it will output: diff --git a/docs/tutorial/connect/create-connected-tables.md b/docs/tutorial/connect/create-connected-tables.md index c18367180d..0d33ee664f 100644 --- a/docs/tutorial/connect/create-connected-tables.md +++ b/docs/tutorial/connect/create-connected-tables.md @@ -57,7 +57,7 @@ Let's start by creating the tables in code. Import the things we need from `sqlmodel` and create a new `Team` model: -{* ./docs_src/tutorial/connect/create_tables/tutorial001_py310.py ln[1:7] hl[4:7] *} +{* ./docs_src/tutorial/connect/create_tables/tutorial001.py ln[1:7] hl[4:7] *} This is very similar to what we have been doing with the `Hero` model. @@ -76,7 +76,7 @@ Now let's create the `hero` table. This is the same model we have been using up to now, we are just adding the new column `team_id`: -{* ./docs_src/tutorial/connect/create_tables/tutorial001_py310.py ln[1:16] hl[16] *} +{* ./docs_src/tutorial/connect/create_tables/tutorial001.py ln[1:16] hl[16] *} Most of that should look familiar: @@ -110,11 +110,11 @@ You can learn about setting a custom table name for a model in the Advanced User Now we can add the same code as before to create the engine and the function to create the tables: -{* ./docs_src/tutorial/connect/create_tables/tutorial001_py310.py ln[19:26] hl[19:20,22,25:26] *} +{* ./docs_src/tutorial/connect/create_tables/tutorial001.py ln[19:26] hl[19:20,22,25:26] *} And as before, we'll call this function from another function `main()`, and we'll add that function `main()` to the main block of the file: -{* ./docs_src/tutorial/connect/create_tables/tutorial001_py310.py ln[29:34] hl[29:30,33:34] *} +{* ./docs_src/tutorial/connect/create_tables/tutorial001.py ln[29:34] hl[29:30,33:34] *} ## Run the Code diff --git a/docs/tutorial/connect/read-connected-data.md b/docs/tutorial/connect/read-connected-data.md index a8bafa2c5a..31719d5b0c 100644 --- a/docs/tutorial/connect/read-connected-data.md +++ b/docs/tutorial/connect/read-connected-data.md @@ -35,7 +35,7 @@ And the `hero` table has this data: We will continue with the code in the previous example and we will add more things to it. -{* ./docs_src/tutorial/connect/insert/tutorial001_py310.py ln[0] *} +{* ./docs_src/tutorial/connect/insert/tutorial001.py ln[0] *} ## `SELECT` Connected Data with SQL @@ -117,7 +117,7 @@ Remember SQLModel's `select()` function? It can take more than one argument. So, we can pass the `Hero` and `Team` model classes. And we can also use both their columns in the `.where()` part: -{* ./docs_src/tutorial/connect/select/tutorial001_py310.py ln[61:63] hl[63] *} +{* ./docs_src/tutorial/connect/select/tutorial001.py ln[61:63] hl[63] *} Notice that in the comparison with `==` we are using the class attributes for both `Hero.team_id` and `Team.id`. @@ -127,7 +127,7 @@ Now we can execute it and get the `results` object. And as we used `select` with two models, we will receive tuples of instances of those two models, so we can iterate over them naturally in a `for` loop: -{* ./docs_src/tutorial/connect/select/tutorial001_py310.py ln[61:66] hl[65] *} +{* ./docs_src/tutorial/connect/select/tutorial001.py ln[61:66] hl[65] *} For each iteration in the `for` loop we get a tuple with an instance of the class `Hero` and an instance of the class `Team`. @@ -145,7 +145,7 @@ And you should get autocompletion and inline errors in your editor for both `her As always, we must remember to add this new `select_heroes()` function to the `main()` function to make sure it is executed when we call this program from the command line. -{* ./docs_src/tutorial/connect/select/tutorial001_py310.py ln[69:72] hl[72] *} +{* ./docs_src/tutorial/connect/select/tutorial001.py ln[69:72] hl[72] *} ## Run the Program @@ -251,7 +251,7 @@ The same way there's a `.where()` available when using `select()`, there's also And in SQLModel (actually SQLAlchemy), we don't have to pass an `ON` part when using `.join()`. It is inferred automatically because we already declared the `foreign_key` in the model definition: -{* ./docs_src/tutorial/connect/select/tutorial002_py310.py ln[61:66] hl[63] *} +{* ./docs_src/tutorial/connect/select/tutorial002.py ln[61:66] hl[63] *} Also notice that we are still including `Team` in the `select(Hero, Team)`, because we still want to access that data. @@ -378,7 +378,7 @@ Now let's replicate the same query in **SQLModel**. `.join()` has a parameter we can use `isouter=True` to make the `JOIN` be a `LEFT OUTER JOIN`: -{* ./docs_src/tutorial/connect/select/tutorial003_py310.py ln[61:66] hl[63] *} +{* ./docs_src/tutorial/connect/select/tutorial003.py ln[61:66] hl[63] *} And if we run it, it will output: @@ -425,7 +425,7 @@ But we would still be able to **filter** the rows with it. 🤓 We could even add some additional `.where()` after `.join()` to filter the data more, for example to return only the heroes from one team: -{* ./docs_src/tutorial/connect/select/tutorial004_py310.py ln[61:66] hl[63] *} +{* ./docs_src/tutorial/connect/select/tutorial004.py ln[61:66] hl[63] *} Here we are **filtering** with `.where()` to get only the heroes that belong to the **Preventers** team. @@ -456,7 +456,7 @@ Preventer Hero: id=2 secret_name='Tommy Sharp' team_id=1 name='Rusty-Man' age=48 By putting the `Team` in `select()` we tell **SQLModel** and the database that we want the team data too. -{* ./docs_src/tutorial/connect/select/tutorial005_py310.py ln[61:66] hl[63] *} +{* ./docs_src/tutorial/connect/select/tutorial005.py ln[61:66] hl[63] *} And if we run that, it will output: diff --git a/docs/tutorial/connect/remove-data-connections.md b/docs/tutorial/connect/remove-data-connections.md index d133b19cb4..92ba8bac26 100644 --- a/docs/tutorial/connect/remove-data-connections.md +++ b/docs/tutorial/connect/remove-data-connections.md @@ -35,7 +35,7 @@ Let's see how to **remove** connections between rows in tables. We will continue with the code from the previous chapter. -{* ./docs_src/tutorial/connect/update/tutorial001_py310.py ln[0] *} +{* ./docs_src/tutorial/connect/update/tutorial001.py ln[0] *} ## Break a Connection @@ -45,7 +45,7 @@ Let's say **Spider-Boy** is tired of the lack of friendly neighbors and wants to We can simply set the `team_id` to `None`, and now it doesn't have a connection with the team: -{* ./docs_src/tutorial/connect/delete/tutorial001_py310.py ln[29:30,66:70] hl[66] *} +{* ./docs_src/tutorial/connect/delete/tutorial001.py ln[29:30,66:70] hl[66] *} Again, we just **assign** a value to that field attribute `team_id`, now the value is `None`, which means `NULL` in the database. Then we `add()` the hero to the session, and then `commit()`. diff --git a/docs/tutorial/connect/update-data-connections.md b/docs/tutorial/connect/update-data-connections.md index bf168843a5..5132beccd8 100644 --- a/docs/tutorial/connect/update-data-connections.md +++ b/docs/tutorial/connect/update-data-connections.md @@ -37,7 +37,7 @@ Now we'll see how to **update** those connections between rows in tables. We will continue with the code we used to create some heroes, and we'll update them. -{* ./docs_src/tutorial/connect/insert/tutorial001_py310.py ln[0] *} +{* ./docs_src/tutorial/connect/insert/tutorial001.py ln[0] *} ## Assign a Team to a Hero @@ -45,7 +45,7 @@ Let's say that **Tommy Sharp** uses his "rich uncle" charms to recruit **Spider- Doing it is just like updating any other field: -{* ./docs_src/tutorial/connect/update/tutorial001_py310.py ln[29:30,60:64] hl[60] *} +{* ./docs_src/tutorial/connect/update/tutorial001.py ln[29:30,60:64] hl[60] *} We can simply **assign** a value to that field attribute `team_id`, then `add()` the hero to the session, and then `commit()`. diff --git a/docs/tutorial/create-db-and-table.md b/docs/tutorial/create-db-and-table.md index 2900ad7367..e1e3b396aa 100644 --- a/docs/tutorial/create-db-and-table.md +++ b/docs/tutorial/create-db-and-table.md @@ -41,7 +41,7 @@ That's why this package is called `SQLModel`. Because it's mainly used to create For that, we will import `SQLModel` (plus other things we will also use) and create a class `Hero` that inherits from `SQLModel` and represents the **table model** for our heroes: -{* ./docs_src/tutorial/create_db_and_table/tutorial001_py310.py ln[1:8] hl[1,4] *} +{* ./docs_src/tutorial/create_db_and_table/tutorial001.py ln[1:8] hl[1,4] *} This class `Hero` **represents the table** for our heroes. And each instance we create later will **represent a row** in the table. @@ -63,7 +63,7 @@ The name of each of these variables will be the name of the column in the table. And the type of each of them will also be the type of table column: -{* ./docs_src/tutorial/create_db_and_table/tutorial001_py310.py ln[1:8] hl[1,5:8] *} +{* ./docs_src/tutorial/create_db_and_table/tutorial001.py ln[1:8] hl[1,5:8] *} Let's now see these field/column declarations in more detail. @@ -75,7 +75,7 @@ That is the standard way to declare that something "could be an `int` or `None`" And we also set the default value of `age` to `None`. -{* ./docs_src/tutorial/create_db_and_table/tutorial001_py310.py ln[1:8] hl[8] *} +{* ./docs_src/tutorial/create_db_and_table/tutorial001.py ln[1:8] hl[8] *} /// tip @@ -107,7 +107,7 @@ So, we need to mark `id` as the **primary key**. To do that, we use the special `Field` function from `sqlmodel` and set the argument `primary_key=True`: -{* ./docs_src/tutorial/create_db_and_table/tutorial001_py310.py ln[1:8] hl[1,5] *} +{* ./docs_src/tutorial/create_db_and_table/tutorial001.py ln[1:8] hl[1,5] *} That way, we tell **SQLModel** that this `id` field/column is the primary key of the table. @@ -150,7 +150,7 @@ If you have a server database (for example PostgreSQL or MySQL), the **engine** Creating the **engine** is very simple, just call `create_engine()` with a URL for the database to use: -{* ./docs_src/tutorial/create_db_and_table/tutorial001_py310.py ln[1:16] hl[1,14] *} +{* ./docs_src/tutorial/create_db_and_table/tutorial001.py ln[1:16] hl[1,14] *} You should normally have a single **engine** object for your whole application and reuse it everywhere. @@ -174,7 +174,7 @@ SQLite supports a special database that lives all *in memory*. Hence, it's very * `sqlite://` -{* ./docs_src/tutorial/create_db_and_table/tutorial001_py310.py ln[1:16] hl[11:12,14] *} +{* ./docs_src/tutorial/create_db_and_table/tutorial001.py ln[1:16] hl[11:12,14] *} You can read a lot more about all the databases supported by **SQLAlchemy** (and that way supported by **SQLModel**) in the [SQLAlchemy documentation](https://docs.sqlalchemy.org/en/14/core/engines.html). @@ -186,7 +186,7 @@ It will make the engine print all the SQL statements it executes, which can help It is particularly useful for **learning** and **debugging**: -{* ./docs_src/tutorial/create_db_and_table/tutorial001_py310.py ln[1:16] hl[14] *} +{* ./docs_src/tutorial/create_db_and_table/tutorial001.py ln[1:16] hl[14] *} But in production, you would probably want to remove `echo=True`: @@ -212,7 +212,7 @@ And SQLModel's version of `create_engine()` is type annotated internally, so you Now everything is in place to finally create the database and table: -{* ./docs_src/tutorial/create_db_and_table/tutorial001_py310.py hl[16] *} +{* ./docs_src/tutorial/create_db_and_table/tutorial001.py hl[16] *} /// tip @@ -323,7 +323,7 @@ Let's run the program to see it all working. Put the code in a file `app.py` if you haven't already. -{* ./docs_src/tutorial/create_db_and_table/tutorial001_py310.py *} +{* ./docs_src/tutorial/create_db_and_table/tutorial001.py *} /// tip @@ -428,7 +428,7 @@ In this example it's just the `SQLModel.metadata.create_all(engine)`. Let's put it in a function `create_db_and_tables()`: -{* ./docs_src/tutorial/create_db_and_table/tutorial002_py310.py ln[1:18] hl[17:18] *} +{* ./docs_src/tutorial/create_db_and_table/tutorial002.py ln[1:18] hl[17:18] *} If `SQLModel.metadata.create_all(engine)` was not in a function and we tried to import something from this module (from this file) in another, it would try to create the database and table **every time** we executed that other file that imported this module. @@ -458,7 +458,7 @@ The word **script** often implies that the code could be run independently and e For that we can use the special variable `__name__` in an `if` block: -{* ./docs_src/tutorial/create_db_and_table/tutorial002_py310.py hl[21:22] *} +{* ./docs_src/tutorial/create_db_and_table/tutorial002.py hl[21:22] *} ### About `__name__ == "__main__"` @@ -552,16 +552,12 @@ But now we can import things from this module in other files. Now, let's give the code a final look: -//// tab | Python 3.10+ - ```{.python .annotate} -{!./docs_src/tutorial/create_db_and_table/tutorial003_py310.py!} +{!./docs_src/tutorial/create_db_and_table/tutorial003.py!} ``` {!./docs_src/tutorial/create_db_and_table/annotations/en/tutorial003.md!} -//// - /// tip Review what each line does by clicking each number bubble in the code. 👆 diff --git a/docs/tutorial/delete.md b/docs/tutorial/delete.md index 4ec9e1f6d4..b2d34be163 100644 --- a/docs/tutorial/delete.md +++ b/docs/tutorial/delete.md @@ -6,7 +6,7 @@ Now let's delete some data using **SQLModel**. As before, we'll continue from where we left off with the previous code. -{* ./docs_src/tutorial/update/tutorial003_py310.py ln[0] *} +{* ./docs_src/tutorial/update/tutorial003.py ln[0] *} Remember to remove the `database.db` file before running the examples to get the same results. @@ -56,11 +56,11 @@ To get the same results, delete the `database.db` file before running the exampl We'll start by selecting the hero `"Spider-Youngster"` that we updated in the previous chapter, this is the one we will delete: -{* ./docs_src/tutorial/delete/tutorial001_py310.py ln[70:75] hl[72] *} +{* ./docs_src/tutorial/delete/tutorial001.py ln[70:75] hl[72] *} As this is a new function `delete_heroes()`, we'll also add it to the `main()` function so that we call it when executing the program from the command line: -{* ./docs_src/tutorial/delete/tutorial001_py310.py ln[90:98] hl[94] *} +{* ./docs_src/tutorial/delete/tutorial001.py ln[90:98] hl[94] *} That will print the same existing hero **Spider-Youngster**: @@ -88,7 +88,7 @@ Hero: name='Spider-Youngster' secret_name='Pedro Parqueador' age=16 id=2 Now, very similar to how we used `session.add()` to add or update new heroes, we can use `session.delete()` to delete the hero from the session: -{* ./docs_src/tutorial/delete/tutorial001_py310.py ln[70:77] hl[77] *} +{* ./docs_src/tutorial/delete/tutorial001.py ln[70:77] hl[77] *} ## Commit the Session @@ -96,7 +96,7 @@ To save the current changes in the session, **commit** it. This will save all the changes stored in the **session**, like the deleted hero: -{* ./docs_src/tutorial/delete/tutorial001_py310.py ln[70:78] hl[78] *} +{* ./docs_src/tutorial/delete/tutorial001.py ln[70:78] hl[78] *} The same as we have seen before, `.commit()` will also save anything else that was added to the session. Including updates, or created heroes. @@ -131,7 +131,7 @@ As the object is not connected to the session, it is not marked as "expired", th Because of that, the object still contains its attributes with the data in it, so we can print it: -{* ./docs_src/tutorial/delete/tutorial001_py310.py ln[70:80] hl[80] *} +{* ./docs_src/tutorial/delete/tutorial001.py ln[70:80] hl[80] *} This will output: @@ -154,7 +154,7 @@ Deleted hero: name='Spider-Youngster' secret_name='Pedro Parqueador' age=16 id=2 To confirm if it was deleted, now let's query the database again, with the same `"Spider-Youngster"` name: -{* ./docs_src/tutorial/delete/tutorial001_py310.py ln[70:84] hl[82:84] *} +{* ./docs_src/tutorial/delete/tutorial001.py ln[70:84] hl[82:84] *} Here we are using `results.first()` to get the first object found (in case it found multiple) or `None`, if it didn't find anything. @@ -191,7 +191,7 @@ Now let's just confirm that, indeed, no hero was found in the database with that We'll do it by checking that the "first" item in the `results` is `None`: -{* ./docs_src/tutorial/delete/tutorial001_py310.py ln[70:87] hl[86:87] *} +{* ./docs_src/tutorial/delete/tutorial001.py ln[70:87] hl[86:87] *} This will output: @@ -217,16 +217,12 @@ INFO Engine ROLLBACK Now let's review all that code: -//// tab | Python 3.10+ - ```{ .python .annotate hl_lines="70-88" } -{!./docs_src/tutorial/delete/tutorial002_py310.py!} +{!./docs_src/tutorial/delete/tutorial002.py!} ``` {!./docs_src/tutorial/delete/annotations/en/tutorial002.md!} -//// - /// tip Check out the number bubbles to see what is done by each line of code. diff --git a/docs/tutorial/fastapi/delete.md b/docs/tutorial/fastapi/delete.md index c7339ef384..9dd4b218ea 100644 --- a/docs/tutorial/fastapi/delete.md +++ b/docs/tutorial/fastapi/delete.md @@ -12,7 +12,7 @@ We get a `hero_id` from the path parameter and verify if it exists, just as we d And if we actually find a hero, we just delete it with the **session**. -{* ./docs_src/tutorial/fastapi/delete/tutorial001_py310.py ln[89:97] hl[89:97] *} +{* ./docs_src/tutorial/fastapi/delete/tutorial001.py ln[89:97] hl[89:97] *} After deleting it successfully, we just return a response of: diff --git a/docs/tutorial/fastapi/limit-and-offset.md b/docs/tutorial/fastapi/limit-and-offset.md index a10d86d6b0..b81b5c2244 100644 --- a/docs/tutorial/fastapi/limit-and-offset.md +++ b/docs/tutorial/fastapi/limit-and-offset.md @@ -22,7 +22,7 @@ By default, we will return the first results from the database, so `offset` will And by default, we will return a maximum of `100` heroes, so `limit` will have a default value of `100`. -{* ./docs_src/tutorial/fastapi/limit_and_offset/tutorial001_py310.py ln[1:2,52:56] hl[1,53,55] *} +{* ./docs_src/tutorial/fastapi/limit_and_offset/tutorial001.py ln[1:2,52:56] hl[1,53,55] *} We want to allow clients to set different `offset` and `limit` values. diff --git a/docs/tutorial/fastapi/multiple-models.md b/docs/tutorial/fastapi/multiple-models.md index d302d4028e..3f75c905e7 100644 --- a/docs/tutorial/fastapi/multiple-models.md +++ b/docs/tutorial/fastapi/multiple-models.md @@ -109,7 +109,7 @@ And we want to have a `HeroPublic` with the `id` field, but this time with a typ The simplest way to solve it could be to create **multiple models**, each one with all the corresponding fields: -{* ./docs_src/tutorial/fastapi/multiple_models/tutorial001_py310.py ln[5:22] hl[5:9,12:15,18:22] *} +{* ./docs_src/tutorial/fastapi/multiple_models/tutorial001.py ln[5:22] hl[5:9,12:15,18:22] *} Here's the important detail, and probably the most important feature of **SQLModel**: only `Hero` is declared with `table = True`. @@ -131,13 +131,13 @@ Let's now see how to use these new models in the FastAPI application. Let's first check how we create a hero now: -{* ./docs_src/tutorial/fastapi/multiple_models/tutorial001_py310.py ln[44:51] hl[44:45,47] *} +{* ./docs_src/tutorial/fastapi/multiple_models/tutorial001.py ln[44:51] hl[44:45,47] *} Let's check that in detail. Now we use the type annotation `HeroCreate` for the request JSON data in the `hero` parameter of the **path operation function**. -{* ./docs_src/tutorial/fastapi/multiple_models/tutorial001_py310.py ln[45] hl[45] *} +{* ./docs_src/tutorial/fastapi/multiple_models/tutorial001.py ln[45] hl[45] *} Then we create a new `Hero` (this is the actual **table** model that saves things to the database) using `Hero.model_validate()`. @@ -151,7 +151,7 @@ In versions of **SQLModel** before `0.0.14` you would use the method `.from_orm( We can now create a new `Hero` instance (the one for the database) and put it in the variable `db_hero` from the data in the `hero` variable that is the `HeroCreate` instance we received from the request. -{* ./docs_src/tutorial/fastapi/multiple_models/tutorial001_py310.py ln[47] hl[47] *} +{* ./docs_src/tutorial/fastapi/multiple_models/tutorial001.py ln[47] hl[47] *} Then we just `add` it to the **session**, `commit`, and `refresh` it, and finally, we return the same `db_hero` variable that has the just refreshed `Hero` instance. @@ -159,7 +159,7 @@ Because it is just refreshed, it has the `id` field set with a new ID taken from And now that we return it, FastAPI will validate the data with the `response_model`, which is a `HeroPublic`: -{* ./docs_src/tutorial/fastapi/multiple_models/tutorial001_py310.py ln[44] hl[44] *} +{* ./docs_src/tutorial/fastapi/multiple_models/tutorial001.py ln[44] hl[44] *} This will validate that all the data that we promised is there and will remove any data we didn't declare. @@ -211,7 +211,7 @@ We can see from above that they all share some **base** fields: So let's create a **base** model `HeroBase` that the others can inherit from: -{* ./docs_src/tutorial/fastapi/multiple_models/tutorial002_py310.py ln[5:8] hl[5:8] *} +{* ./docs_src/tutorial/fastapi/multiple_models/tutorial002.py ln[5:8] hl[5:8] *} As you can see, this is *not* a **table model**, it doesn't have the `table = True` config. @@ -221,7 +221,7 @@ But now we can create the **other models inheriting from it**, they will all sha Let's start with the only **table model**, the `Hero`: -{* ./docs_src/tutorial/fastapi/multiple_models/tutorial002_py310.py ln[5:12] hl[11:12] *} +{* ./docs_src/tutorial/fastapi/multiple_models/tutorial002.py ln[5:12] hl[11:12] *} Notice that `Hero` now doesn't inherit from `SQLModel`, but from `HeroBase`. @@ -237,7 +237,7 @@ And those inherited fields will also be in the **autocompletion** and **inline e Notice that the parent model `HeroBase` is not a **table model**, but still, we can declare `name` and `age` using `Field(index=True)`. -{* ./docs_src/tutorial/fastapi/multiple_models/tutorial002_py310.py ln[5:12] hl[6,8,11] *} +{* ./docs_src/tutorial/fastapi/multiple_models/tutorial002.py ln[5:12] hl[6,8,11] *} This won't affect this parent **data model** `HeroBase`. @@ -249,7 +249,7 @@ Now let's see the `HeroCreate` model that will be used to define the data that w This is a fun one: -{* ./docs_src/tutorial/fastapi/multiple_models/tutorial002_py310.py ln[5:16] hl[15:16] *} +{* ./docs_src/tutorial/fastapi/multiple_models/tutorial002.py ln[5:16] hl[15:16] *} What's happening here? @@ -269,7 +269,7 @@ Now let's check the `HeroPublic` model. This one just declares that the `id` field is required when reading a hero from the API, because a hero read from the API will come from the database, and in the database it will always have an ID. -{* ./docs_src/tutorial/fastapi/multiple_models/tutorial002_py310.py ln[5:20] hl[19:20] *} +{* ./docs_src/tutorial/fastapi/multiple_models/tutorial002.py ln[5:20] hl[19:20] *} ## Review the Updated Docs UI diff --git a/docs/tutorial/fastapi/read-one.md b/docs/tutorial/fastapi/read-one.md index fec0f711f0..900a1b09f6 100644 --- a/docs/tutorial/fastapi/read-one.md +++ b/docs/tutorial/fastapi/read-one.md @@ -14,7 +14,7 @@ If you need to refresh how *path parameters* work, including their data validati /// -{* ./docs_src/tutorial/fastapi/read_one/tutorial001_py310.py ln[1:2,59:65] hl[59] *} +{* ./docs_src/tutorial/fastapi/read_one/tutorial001.py ln[1:2,59:65] hl[59] *} For example, to get the hero with ID `2` we would send a `GET` request to: @@ -34,7 +34,7 @@ And to use it, we first import `HTTPException` from `fastapi`. This will let the client know that they probably made a mistake on their side and requested a hero that doesn't exist in the database. -{* ./docs_src/tutorial/fastapi/read_one/tutorial001_py310.py ln[1:2,59:65] hl[1,62:64] *} +{* ./docs_src/tutorial/fastapi/read_one/tutorial001.py ln[1:2,59:65] hl[1,62:64] *} ## Return the Hero @@ -42,7 +42,7 @@ Then, if the hero exists, we return it. And because we are using the `response_model` with `HeroPublic`, it will be validated, documented, etc. -{* ./docs_src/tutorial/fastapi/read_one/tutorial001_py310.py ln[1:2,59:65] hl[59,65] *} +{* ./docs_src/tutorial/fastapi/read_one/tutorial001.py ln[1:2,59:65] hl[59,65] *} ## Check the Docs UI diff --git a/docs/tutorial/fastapi/relationships.md b/docs/tutorial/fastapi/relationships.md index 697011de10..204be3189b 100644 --- a/docs/tutorial/fastapi/relationships.md +++ b/docs/tutorial/fastapi/relationships.md @@ -44,13 +44,13 @@ It's because we declared the `HeroPublic` with only the same base fields of the And the same way, we declared the `TeamPublic` with only the same base fields of the `TeamBase` plus the `id`. But it doesn't include a field `heroes` for the **relationship attribute**. -{* ./docs_src/tutorial/fastapi/teams/tutorial001_py310.py ln[5:7,20:21,29:34,43:44] hl[5:7,20:21,29:34,43:44] *} +{* ./docs_src/tutorial/fastapi/teams/tutorial001.py ln[5:7,20:21,29:34,43:44] hl[5:7,20:21,29:34,43:44] *} Now, remember that [FastAPI uses the `response_model` to validate and **filter** the response data](https://fastapi.tiangolo.com/tutorial/response-model/)? In this case, we used `response_model=TeamPublic` and `response_model=HeroPublic`, so FastAPI will use them to filter the response data, even if we return a **table model** that includes **relationship attributes**: -{* ./docs_src/tutorial/fastapi/teams/tutorial001_py310.py ln[102:107,155:160] hl[102,107,155,160] *} +{* ./docs_src/tutorial/fastapi/teams/tutorial001.py ln[102:107,155:160] hl[102,107,155,160] *} ## Don't Include All the Data @@ -132,7 +132,7 @@ Let's add the models `HeroPublicWithTeam` and `TeamPublicWithHeroes`. We'll add them **after** the other models so that we can easily reference the previous models. -{* ./docs_src/tutorial/fastapi/relationships/tutorial001_py310.py ln[59:64] hl[59:60,63:64] *} +{* ./docs_src/tutorial/fastapi/relationships/tutorial001.py ln[59:64] hl[59:60,63:64] *} These two models are very **simple in code**, but there's a lot happening here. Let's check it out. @@ -166,7 +166,7 @@ This will tell **FastAPI** to take the object that we return from the *path oper In the case of the hero, this tells FastAPI to extract the `team` too. And in the case of the team, to extract the list of `heroes` too. -{* ./docs_src/tutorial/fastapi/relationships/tutorial001_py310.py ln[111:116,164:169] hl[111,116,164,169] *} +{* ./docs_src/tutorial/fastapi/relationships/tutorial001.py ln[111:116,164:169] hl[111,116,164,169] *} ## Check It Out in the Docs UI diff --git a/docs/tutorial/fastapi/response-model.md b/docs/tutorial/fastapi/response-model.md index 029c371ad8..a09f8aa4a2 100644 --- a/docs/tutorial/fastapi/response-model.md +++ b/docs/tutorial/fastapi/response-model.md @@ -32,7 +32,7 @@ We can use `response_model` to tell FastAPI the schema of the data we want to se For example, we can pass the same `Hero` **SQLModel** class (because it is also a Pydantic model): -{* ./docs_src/tutorial/fastapi/response_model/tutorial001_py310.py ln[31:37] hl[31] *} +{* ./docs_src/tutorial/fastapi/response_model/tutorial001.py ln[31:37] hl[31] *} ## List of Heroes in `response_model` @@ -40,7 +40,7 @@ We can also use other type annotations, the same way we can use with Pydantic fi To do so, we declare the `response_model` with `list[Hero]`: -{* ./docs_src/tutorial/fastapi/response_model/tutorial001_py310.py ln[40:44] hl[40] *} +{* ./docs_src/tutorial/fastapi/response_model/tutorial001.py ln[40:44] hl[40] *} ## FastAPI and Response Model diff --git a/docs/tutorial/fastapi/session-with-dependency.md b/docs/tutorial/fastapi/session-with-dependency.md index 11c6a4c3a4..a13054866e 100644 --- a/docs/tutorial/fastapi/session-with-dependency.md +++ b/docs/tutorial/fastapi/session-with-dependency.md @@ -6,7 +6,7 @@ Before we keep adding things, let's change a bit how we get the session for each Up to now, we have been creating a session in each *path operation*, in a `with` block. -{* ./docs_src/tutorial/fastapi/delete/tutorial001_py310.py ln[48:55] hl[50] *} +{* ./docs_src/tutorial/fastapi/delete/tutorial001.py ln[48:55] hl[50] *} That's perfectly fine, but in many use cases we would want to use [FastAPI Dependencies](https://fastapi.tiangolo.com/tutorial/dependencies/), for example to **verify** that the client is **logged in** and get the **current user** before executing any other code in the *path operation*. @@ -20,7 +20,7 @@ A **FastAPI** dependency is very simple, it's just a function that returns a val It could use `yield` instead of `return`, and in that case **FastAPI** will make sure it executes all the code **after** the `yield`, once it is done with the request. -{* ./docs_src/tutorial/fastapi/session_with_dependency/tutorial001_py310.py ln[40:42] hl[40:42] *} +{* ./docs_src/tutorial/fastapi/session_with_dependency/tutorial001.py ln[40:42] hl[40:42] *} ## Use the Dependency @@ -28,7 +28,7 @@ Now let's make FastAPI execute a dependency and get its value in the *path opera We import `Depends()` from `fastapi`. Then we use it in the *path operation function* in a **parameter**, the same way we declared parameters to get JSON bodies, path parameters, etc. -{* ./docs_src/tutorial/fastapi/session_with_dependency/tutorial001_py310.py ln[1:2,40:42,53:59] hl[1,54] *} +{* ./docs_src/tutorial/fastapi/session_with_dependency/tutorial001.py ln[1:2,40:42,53:59] hl[1,54] *} /// tip @@ -56,13 +56,13 @@ And because dependencies can use `yield`, FastAPI will make sure to run the code This means that in the main code of the *path operation function*, it will work equivalently to the previous version with the explicit `with` block. -{* ./docs_src/tutorial/fastapi/session_with_dependency/tutorial001_py310.py ln[1:2,40:42,53:59] hl[55:59] *} +{* ./docs_src/tutorial/fastapi/session_with_dependency/tutorial001.py ln[1:2,40:42,53:59] hl[55:59] *} In fact, you could think that all that block of code inside of the `create_hero()` function is still inside a `with` block for the **session**, because this is more or less what's happening behind the scenes. But now, the `with` block is not explicitly in the function, but in the dependency above: -{* ./docs_src/tutorial/fastapi/session_with_dependency/tutorial001_py310.py ln[1:2,40:42,53:59] hl[41:42] *} +{* ./docs_src/tutorial/fastapi/session_with_dependency/tutorial001.py ln[1:2,40:42,53:59] hl[41:42] *} We will see how this is very useful when testing the code later. ✅ @@ -78,7 +78,7 @@ session: Session = Depends(get_session) And then we remove the previous `with` block with the old **session**. -{* ./docs_src/tutorial/fastapi/session_with_dependency/tutorial001_py310.py ln[1:2,40:42,53:104] hl[54,65,74,83,98] *} +{* ./docs_src/tutorial/fastapi/session_with_dependency/tutorial001.py ln[1:2,40:42,53:104] hl[54,65,74,83,98] *} ## Recap diff --git a/docs/tutorial/fastapi/simple-hero-api.md b/docs/tutorial/fastapi/simple-hero-api.md index 07417aa79c..4334a94413 100644 --- a/docs/tutorial/fastapi/simple-hero-api.md +++ b/docs/tutorial/fastapi/simple-hero-api.md @@ -28,7 +28,7 @@ We will start with the **simplest version**, with just heroes (no teams yet). This is almost the same code we have seen up to now in previous examples: -{* ./docs_src/tutorial/fastapi/simple_hero_api/tutorial001_py310.py ln[2,5:20] hl[19:20] *} +{* ./docs_src/tutorial/fastapi/simple_hero_api/tutorial001.py ln[2,5:20] hl[19:20] *} There's only one change here from the code we have used before, the `check_same_thread` in the `connect_args`. @@ -56,7 +56,7 @@ We will import the `FastAPI` class from `fastapi`. And then create an `app` object that is an instance of that `FastAPI` class: -{* ./docs_src/tutorial/fastapi/simple_hero_api/tutorial001_py310.py ln[1:2,23] hl[1,23] *} +{* ./docs_src/tutorial/fastapi/simple_hero_api/tutorial001.py ln[1:2,23] hl[1,23] *} ## Create Database and Tables on `startup` @@ -64,7 +64,7 @@ We want to make sure that once the app starts running, the function `create_db_a This should be called only once at startup, not before every request, so we put it in the function to handle the `"startup"` event: -{* ./docs_src/tutorial/fastapi/simple_hero_api/tutorial001_py310.py ln[23:28] hl[26:28] *} +{* ./docs_src/tutorial/fastapi/simple_hero_api/tutorial001.py ln[23:28] hl[26:28] *} ## Create Heroes *Path Operation* @@ -78,7 +78,7 @@ Let's create the **path operation** code to create a new hero. It will be called when a user sends a request with a `POST` **operation** to the `/heroes/` **path**: -{* ./docs_src/tutorial/fastapi/simple_hero_api/tutorial001_py310.py ln[23:37] hl[31:32] *} +{* ./docs_src/tutorial/fastapi/simple_hero_api/tutorial001.py ln[23:37] hl[31:32] *} /// note @@ -112,7 +112,7 @@ We will improve this further later, but for now, it already shows the power of h Now let's add another **path operation** to read all the heroes: -{* ./docs_src/tutorial/fastapi/simple_hero_api/tutorial001_py310.py ln[23:44] hl[40:44] *} +{* ./docs_src/tutorial/fastapi/simple_hero_api/tutorial001.py ln[23:44] hl[40:44] *} This is pretty straightforward. diff --git a/docs/tutorial/fastapi/teams.md b/docs/tutorial/fastapi/teams.md index eafe4659a6..944284b053 100644 --- a/docs/tutorial/fastapi/teams.md +++ b/docs/tutorial/fastapi/teams.md @@ -18,7 +18,7 @@ Then we also inherit from the `TeamBase` for the `TeamCreate` and `TeamPublic` * And we also create a `TeamUpdate` **data model**. -{* ./docs_src/tutorial/fastapi/teams/tutorial001_py310.py ln[1:26] hl[5:7,10:13,16:17,20:21,24:26] *} +{* ./docs_src/tutorial/fastapi/teams/tutorial001.py ln[1:26] hl[5:7,10:13,16:17,20:21,24:26] *} We now also have **relationship attributes**. 🎉 @@ -26,7 +26,7 @@ Let's now update the `Hero` models too. ## Update Hero Models -{* ./docs_src/tutorial/fastapi/teams/tutorial001_py310.py ln[29:55] hl[29:34,37:40,43:44,47:48,51:55] *} +{* ./docs_src/tutorial/fastapi/teams/tutorial001.py ln[29:55] hl[29:34,37:40,43:44,47:48,51:55] *} We now have a `team_id` in the hero models. @@ -38,7 +38,7 @@ And even though the `HeroBase` is *not* a **table model**, we can declare `team_ Notice that the **relationship attributes**, the ones with `Relationship()`, are **only** in the **table models**, as those are the ones that are handled by **SQLModel** with SQLAlchemy and that can have the automatic fetching of data from the database when we access them. -{* ./docs_src/tutorial/fastapi/teams/tutorial001_py310.py ln[5:55] hl[13,40] *} +{* ./docs_src/tutorial/fastapi/teams/tutorial001.py ln[5:55] hl[13,40] *} ## Path Operations for Teams @@ -46,7 +46,7 @@ Let's now add the **path operations** for teams. These are equivalent and very similar to the **path operations** for the **heroes** we had before, so we don't have to go over the details for each one, let's check the code. -{* ./docs_src/tutorial/fastapi/teams/tutorial001_py310.py ln[135:188] hl[135:141,144:152,155:160,163:178,181:188] *} +{* ./docs_src/tutorial/fastapi/teams/tutorial001.py ln[135:188] hl[135:141,144:152,155:160,163:178,181:188] *} ## Using Relationship Attributes diff --git a/docs/tutorial/fastapi/tests.md b/docs/tutorial/fastapi/tests.md index 7ec9bd9450..048f6c56c0 100644 --- a/docs/tutorial/fastapi/tests.md +++ b/docs/tutorial/fastapi/tests.md @@ -14,7 +14,7 @@ We will use the application with the hero models, but without team models, and w Now we will see how useful it is to have this session dependency. ✨ -{* ./docs_src/tutorial/fastapi/app_testing/tutorial001_py310/main.py ln[0] *} +{* ./docs_src/tutorial/fastapi/app_testing/tutorial001/main.py ln[0] *} ## File Structure @@ -53,16 +53,16 @@ $ uv add requests pytest Let's start with a simple test, with just the basic test code we need to check that the **FastAPI** application is creating a new hero correctly. ```{ .python .annotate } -{!./docs_src/tutorial/fastapi/app_testing/tutorial001_py310/test_main_001.py[ln:1-7]!} +{!./docs_src/tutorial/fastapi/app_testing/tutorial001/test_main_001.py[ln:1-7]!} # Some code here omitted, we will see it later 👈 -{!./docs_src/tutorial/fastapi/app_testing/tutorial001_py310/test_main_001.py[ln:20-24]!} +{!./docs_src/tutorial/fastapi/app_testing/tutorial001/test_main_001.py[ln:20-24]!} # Some code here omitted, we will see it later 👈 -{!./docs_src/tutorial/fastapi/app_testing/tutorial001_py310/test_main_001.py[ln:26-32]!} +{!./docs_src/tutorial/fastapi/app_testing/tutorial001/test_main_001.py[ln:26-32]!} # Code below omitted 👇 ``` -{!./docs_src/tutorial/fastapi/app_testing/tutorial001_py310/annotations/en/test_main_001.md!} +{!./docs_src/tutorial/fastapi/app_testing/tutorial001/annotations/en/test_main_001.md!} /// tip @@ -103,14 +103,14 @@ We will override it to use a different **session** object just for the tests. That way we protect the production database and we have better control of the data we are testing. ```{ .python .annotate hl_lines="4 9-10 12 19" } -{!./docs_src/tutorial/fastapi/app_testing/tutorial001_py310/test_main_002.py[ln:1-7]!} +{!./docs_src/tutorial/fastapi/app_testing/tutorial001/test_main_002.py[ln:1-7]!} # Some code here omitted, we will see it later 👈 -{!./docs_src/tutorial/fastapi/app_testing/tutorial001_py310/test_main_002.py[ln:15-32]!} +{!./docs_src/tutorial/fastapi/app_testing/tutorial001/test_main_002.py[ln:15-32]!} # Code below omitted 👇 ``` -{!./docs_src/tutorial/fastapi/app_testing/tutorial001_py310/annotations/en/test_main_002.md!} +{!./docs_src/tutorial/fastapi/app_testing/tutorial001/annotations/en/test_main_002.md!} /// tip @@ -131,10 +131,10 @@ sqlite:///testing.db So, the testing database will be in the file `testing.db`. ``` { .python .annotate hl_lines="4 8-11 13 16 33"} -{!./docs_src/tutorial/fastapi/app_testing/tutorial001_py310/test_main_003.py!} +{!./docs_src/tutorial/fastapi/app_testing/tutorial001/test_main_003.py!} ``` -{!./docs_src/tutorial/fastapi/app_testing/tutorial001_py310/annotations/en/test_main_003.md!} +{!./docs_src/tutorial/fastapi/app_testing/tutorial001/annotations/en/test_main_003.md!} ### Import Table Models @@ -187,12 +187,12 @@ Let's update our code to use the in-memory database. We just have to change a couple of parameters in the **engine**. ```{ .python .annotate hl_lines="3 9-13"} -{!./docs_src/tutorial/fastapi/app_testing/tutorial001_py310/test_main_004.py[ln:1-13]!} +{!./docs_src/tutorial/fastapi/app_testing/tutorial001/test_main_004.py[ln:1-13]!} # Code below omitted 👇 ``` -{!./docs_src/tutorial/fastapi/app_testing/tutorial001_py310/annotations/en/test_main_004.md!} +{!./docs_src/tutorial/fastapi/app_testing/tutorial001/annotations/en/test_main_004.md!} /// tip @@ -235,10 +235,10 @@ You can read more about them in the [pytest docs for fixtures](https://docs.pyte Let's see the first code example with a fixture: ``` { .python .annotate } -{!./docs_src/tutorial/fastapi/app_testing/tutorial001_py310/test_main_005.py!} +{!./docs_src/tutorial/fastapi/app_testing/tutorial001/test_main_005.py!} ``` -{!./docs_src/tutorial/fastapi/app_testing/tutorial001_py310/annotations/en/test_main_005.md!} +{!./docs_src/tutorial/fastapi/app_testing/tutorial001/annotations/en/test_main_005.md!} /// tip @@ -275,10 +275,10 @@ Each **pytest** fixture (the same way as **FastAPI** dependencies), can require So, we can create a **client fixture** that will be used in all the tests, and it will itself require the **session fixture**. ``` { .python .annotate hl_lines="19-28 31" } -{!./docs_src/tutorial/fastapi/app_testing/tutorial001_py310/test_main_006.py!} +{!./docs_src/tutorial/fastapi/app_testing/tutorial001/test_main_006.py!} ``` -{!./docs_src/tutorial/fastapi/app_testing/tutorial001_py310/annotations/en/test_main_006.md!} +{!./docs_src/tutorial/fastapi/app_testing/tutorial001/annotations/en/test_main_006.md!} /// tip @@ -298,7 +298,7 @@ But normally we will create **lots of other test functions**. And now all the bo Let's add some more tests: -{* ./docs_src/tutorial/fastapi/app_testing/tutorial001_py310/test_main.py ln[30:58] hl[30,49] *} +{* ./docs_src/tutorial/fastapi/app_testing/tutorial001/test_main.py ln[30:58] hl[30,49] *} /// tip @@ -318,7 +318,7 @@ For these examples, **that would have been simpler**, there's no need to separat But for the next test function, we will require **both fixtures**, the **client** and the **session**. -{* ./docs_src/tutorial/fastapi/app_testing/tutorial001_py310/test_main.py ln[1:6,61:81] hl[6,61] *} +{* ./docs_src/tutorial/fastapi/app_testing/tutorial001/test_main.py ln[1:6,61:81] hl[6,61] *} In this test function, we want to check that the *path operation* to **read a list of heroes** actually sends us heroes. @@ -344,7 +344,7 @@ The function for the **client fixture** and the actual testing function will **b Using the same ideas, requiring the fixtures, creating data that we need for the tests, etc., we can now add the rest of the tests. They look quite similar to what we have done up to now. -{* ./docs_src/tutorial/fastapi/app_testing/tutorial001_py310/test_main.py ln[84:125] hl[84,99,114] *} +{* ./docs_src/tutorial/fastapi/app_testing/tutorial001/test_main.py ln[84:125] hl[84,99,114] *} ## Run the Tests diff --git a/docs/tutorial/fastapi/update-extra-data.md b/docs/tutorial/fastapi/update-extra-data.md index bff57784f6..6c97a975b1 100644 --- a/docs/tutorial/fastapi/update-extra-data.md +++ b/docs/tutorial/fastapi/update-extra-data.md @@ -38,7 +38,7 @@ The `Hero` table model will now store a new field `hashed_password`. And the data models for `HeroCreate` and `HeroUpdate` will also have a new field `password` that will contain the plain text password sent by clients. -{* ./docs_src/tutorial/fastapi/update/tutorial002_py310.py ln[5:28] hl[13,17,28] *} +{* ./docs_src/tutorial/fastapi/update/tutorial002.py ln[5:28] hl[13,17,28] *} When a client is creating a new hero, they will send the `password` in the request body. @@ -50,7 +50,7 @@ The app will receive the data from the client using the `HeroCreate` model. This contains the `password` field with the plain text password, and we cannot use that one. So we need to generate a hash from it. -{* ./docs_src/tutorial/fastapi/update/tutorial002_py310.py ln[42:44,55:57] hl[57] *} +{* ./docs_src/tutorial/fastapi/update/tutorial002.py ln[42:44,55:57] hl[57] *} ## Create an Object with Extra Data @@ -106,7 +106,7 @@ So now, `db_user_dict` has the updated `age` field with `32` instead of `None` a Similar to how dictionaries have an `update` method, **SQLModel** models have a parameter `update` in `Hero.model_validate()` that takes a dictionary with extra data, or data that should take precedence: -{* ./docs_src/tutorial/fastapi/update/tutorial002_py310.py ln[55:64] hl[60] *} +{* ./docs_src/tutorial/fastapi/update/tutorial002.py ln[55:64] hl[60] *} Now, `db_hero` (which is a *table model* `Hero`) will extract its values from `hero` (which is a *data model* `HeroCreate`), and then it will **`update`** its values with the extra data from the dictionary `extra_data`. @@ -120,7 +120,7 @@ Now let's say we want to **update a hero** that already exists in the database. The same way as before, to avoid removing existing data, we will use `exclude_unset=True` when calling `hero.model_dump()`, to get a dictionary with only the data sent by the client. -{* ./docs_src/tutorial/fastapi/update/tutorial002_py310.py ln[83:89] hl[89] *} +{* ./docs_src/tutorial/fastapi/update/tutorial002.py ln[83:89] hl[89] *} Now, this `hero_data` dictionary could contain a `password`. We need to check it, and if it's there, we need to generate the `hashed_password`. @@ -130,7 +130,7 @@ And then we can update the `db_hero` object using the method `db_hero.sqlmodel_u It takes a model object or dictionary with the data to update the object and also an **additional `update` argument** with extra data. -{* ./docs_src/tutorial/fastapi/update/tutorial002_py310.py ln[83:99] hl[95] *} +{* ./docs_src/tutorial/fastapi/update/tutorial002.py ln[83:99] hl[95] *} /// tip diff --git a/docs/tutorial/fastapi/update.md b/docs/tutorial/fastapi/update.md index 59baf1b5d5..58fa9faa74 100644 --- a/docs/tutorial/fastapi/update.md +++ b/docs/tutorial/fastapi/update.md @@ -22,7 +22,7 @@ Because each field is **actually different** (we just set a default value of `No So, let's create this new `HeroUpdate` model: -{* ./docs_src/tutorial/fastapi/update/tutorial001_py310.py ln[5:26] hl[23:26] *} +{* ./docs_src/tutorial/fastapi/update/tutorial001.py ln[5:26] hl[23:26] *} This is almost the same as `HeroBase`, but all the fields are optional, so we can't simply inherit from `HeroBase`. @@ -32,7 +32,7 @@ Now let's use this model in the *path operation* to update a hero. We will use a `PATCH` HTTP operation. This is used to **partially update data**, which is what we are doing. -{* ./docs_src/tutorial/fastapi/update/tutorial001_py310.py ln[74:89] hl[74:75] *} +{* ./docs_src/tutorial/fastapi/update/tutorial001.py ln[74:89] hl[74:75] *} We also read the `hero_id` from the *path parameter* and the request body, a `HeroUpdate`. @@ -42,7 +42,7 @@ We take a `hero_id` with the **ID** of the hero **we want to update**. So, we need to read the hero from the database, with the **same logic** we used to **read a single hero**, checking if it exists, possibly raising an error for the client if it doesn't exist, etc. -{* ./docs_src/tutorial/fastapi/update/tutorial001_py310.py ln[74:89] hl[77:79] *} +{* ./docs_src/tutorial/fastapi/update/tutorial001.py ln[74:89] hl[77:79] *} ### Get the New Data @@ -92,7 +92,7 @@ Then the dictionary we would get in Python using `hero.model_dump(exclude_unset= Then we use that to get the data that was actually sent by the client: -{* ./docs_src/tutorial/fastapi/update/tutorial001_py310.py ln[74:89] hl[80] *} +{* ./docs_src/tutorial/fastapi/update/tutorial001.py ln[74:89] hl[80] *} /// tip Before SQLModel 0.0.14, the method was called `hero.dict(exclude_unset=True)`, but it was renamed to `hero.model_dump(exclude_unset=True)` to be consistent with Pydantic v2. @@ -102,7 +102,7 @@ Before SQLModel 0.0.14, the method was called `hero.dict(exclude_unset=True)`, b Now that we have a **dictionary with the data sent by the client**, we can use the method `db_hero.sqlmodel_update()` to update the object `db_hero`. -{* ./docs_src/tutorial/fastapi/update/tutorial001_py310.py ln[74:89] hl[81] *} +{* ./docs_src/tutorial/fastapi/update/tutorial001.py ln[74:89] hl[81] *} /// tip diff --git a/docs/tutorial/indexes.md b/docs/tutorial/indexes.md index 2a411671a6..56e197543e 100644 --- a/docs/tutorial/indexes.md +++ b/docs/tutorial/indexes.md @@ -20,7 +20,7 @@ Are you already a **SQL expert** and don't have time for all my explanations? Fine, in that case, you can **sneak peek** the final code to create indexes here. -{* ./docs_src/tutorial/indexes/tutorial002_py310.py ln[0] *} +{* ./docs_src/tutorial/indexes/tutorial002.py ln[0] *} ..but if you are not an expert, **continue reading**, this will probably be useful. 🤓 @@ -257,11 +257,11 @@ The change in code is underwhelming, it's very simple. 😆 Here's the `Hero` model we had before: -{* ./docs_src/tutorial/where/tutorial001_py310.py ln[1:8] hl[6] *} +{* ./docs_src/tutorial/where/tutorial001.py ln[1:8] hl[6] *} Let's now update it to tell **SQLModel** to create an index for the `name` field when creating the table: -{* ./docs_src/tutorial/indexes/tutorial001_py310.py ln[1:8] hl[6] *} +{* ./docs_src/tutorial/indexes/tutorial001.py ln[1:8] hl[6] *} We use the same `Field()` again as we did before, and set `index=True`. That's it! 🚀 @@ -283,7 +283,7 @@ The SQL database will figure it out **automatically**. ✨ This is great because it means that indexes are very **simple to use**. But it might also feel counterintuitive at first, as you are **not doing anything** explicitly in the code to make it obvious that the index is useful, it all happens in the database behind the scenes. -{* ./docs_src/tutorial/indexes/tutorial001_py310.py ln[34:39] hl[36] *} +{* ./docs_src/tutorial/indexes/tutorial001.py ln[34:39] hl[36] *} This is exactly the same code as we had before, but now the database will **use the index** underneath. @@ -326,7 +326,7 @@ secret_name='Dive Wilson' age=None id=1 name='Deadpond' We are going to query the `hero` table doing comparisons on the `age` field too, so we should **define an index** for that one as well: -{* ./docs_src/tutorial/indexes/tutorial002_py310.py ln[1:8] hl[8] *} +{* ./docs_src/tutorial/indexes/tutorial002.py ln[1:8] hl[8] *} In this case, we want the default value of `age` to continue being `None`, so we set `default=None` when using `Field()`. diff --git a/docs/tutorial/insert.md b/docs/tutorial/insert.md index 4f71d7873c..28788ef704 100644 --- a/docs/tutorial/insert.md +++ b/docs/tutorial/insert.md @@ -25,20 +25,16 @@ We will continue from where we left off in the last chapter. This is the code we had to create the database and table, nothing new here: -//// tab | Python 3.10+ - ```{.python .annotate hl_lines="20" } -{!./docs_src/tutorial/create_db_and_table/tutorial003_py310.py[ln:1-18]!} +{!./docs_src/tutorial/create_db_and_table/tutorial003.py[ln:1-18]!} # More code here later 👈 -{!./docs_src/tutorial/create_db_and_table/tutorial003_py310.py[ln:21-22]!} +{!./docs_src/tutorial/create_db_and_table/tutorial003.py[ln:21-22]!} ``` {!./docs_src/tutorial/create_db_and_table/annotations/en/tutorial003.md!} -//// - Now that we can create the database and the table, we will continue from this point and add more code in the same file to create the data. ## Create Data with SQL @@ -131,7 +127,7 @@ So, the first step is to simply create an instance of `Hero`. We'll create 3 right away, for the 3 heroes: -{* ./docs_src/tutorial/insert/tutorial002_py310.py ln[21:24] *} +{* ./docs_src/tutorial/insert/tutorial002.py ln[21:24] *} /// tip @@ -163,11 +159,11 @@ We would reuse the same **engine** in all the code, everywhere in the applicatio The first step is to import the `Session` class: -{* ./docs_src/tutorial/insert/tutorial001_py310.py ln[1] hl[1] *} +{* ./docs_src/tutorial/insert/tutorial001.py ln[1] hl[1] *} Then we can create a new session: -{* ./docs_src/tutorial/insert/tutorial001_py310.py ln[21:26] hl[26] *} +{* ./docs_src/tutorial/insert/tutorial001.py ln[21:26] hl[26] *} The new `Session` takes an `engine` as a parameter. And it will use the **engine** underneath. @@ -181,7 +177,7 @@ We will see a better way to create a **session** using a `with` block later. Now that we have some hero model instances (some objects in memory) and a **session**, the next step is to add them to the session: -{* ./docs_src/tutorial/insert/tutorial001_py310.py ln[21:30] hl[28:30] *} +{* ./docs_src/tutorial/insert/tutorial001.py ln[21:30] hl[28:30] *} By this point, our heroes are *not* stored in the database yet. @@ -205,7 +201,7 @@ This ensures that the data is saved in a single batch, and that it will all succ Now that we have the heroes in the **session** and that we are ready to save all that to the database, we can **commit** the changes: -{* ./docs_src/tutorial/insert/tutorial001_py310.py ln[21:32] hl[32] *} +{* ./docs_src/tutorial/insert/tutorial001.py ln[21:32] hl[32] *} Once this line is executed, the **session** will use the **engine** to save all the data in the database by sending the corresponding SQL. @@ -232,11 +228,11 @@ if __name__ == "__main__": But to keep things a bit more organized, let's instead create a new function `main()` that will contain all the code that should be executed when called as an independent script, and we can put there the previous function `create_db_and_tables()`, and add the new function `create_heroes()`: -{* ./docs_src/tutorial/insert/tutorial002_py310.py ln[34:36] hl[34,36] *} +{* ./docs_src/tutorial/insert/tutorial002.py ln[34:36] hl[34,36] *} And then we can call that single `main()` function from that main block: -{* ./docs_src/tutorial/insert/tutorial002_py310.py ln[34:40] hl[40] *} +{* ./docs_src/tutorial/insert/tutorial002.py ln[34:40] hl[40] *} By having everything that should happen when called as a script in a single function, we can easily add more code later on. @@ -291,7 +287,7 @@ The **session** holds some resources, like connections from the engine. So once we are done with the session, we should **close** it to make it release those resources and finish its cleanup: -{* ./docs_src/tutorial/insert/tutorial001_py310.py ln[21:34] hl[34] *} +{* ./docs_src/tutorial/insert/tutorial001.py ln[21:34] hl[34] *} But what happens if we forget to close the session? @@ -305,7 +301,7 @@ It's good to know how the `Session` works and how to create and close it manuall But there's a better way to handle the session, using a `with` block: -{* ./docs_src/tutorial/insert/tutorial002_py310.py ln[21:31] hl[26:31] *} +{* ./docs_src/tutorial/insert/tutorial002.py ln[21:31] hl[26:31] *} This is the same as creating the session manually and then manually closing it. But here, using a `with` block, it will be automatically created when **starting** the `with` block and assigned to the variable `session`, and it will be automatically closed after the `with` block is **finished**. @@ -319,16 +315,12 @@ You already know all of the first part for creating the `Hero` model class, the Let's focus on the new code: -//// tab | Python 3.10+ - ```{.python .annotate } -{!./docs_src/tutorial/insert/tutorial003_py310.py!} +{!./docs_src/tutorial/insert/tutorial003.py!} ``` {!./docs_src/tutorial/insert/annotations/en/tutorial003.md!} -//// - /// tip Review what each line does by clicking each number bubble in the code. 👆 diff --git a/docs/tutorial/limit-and-offset.md b/docs/tutorial/limit-and-offset.md index f00e416f48..99928ee66a 100644 --- a/docs/tutorial/limit-and-offset.md +++ b/docs/tutorial/limit-and-offset.md @@ -14,13 +14,13 @@ We will continue with the same code as before, but we'll modify the `select_hero Again, we will create several heroes to have some data to select from: -{* ./docs_src/tutorial/offset_and_limit/tutorial001_py310.py ln[21:39] hl[22:28] *} +{* ./docs_src/tutorial/offset_and_limit/tutorial001.py ln[21:39] hl[22:28] *} ## Review Select All This is the code we had to select all the heroes in the `select()` examples: -{* ./docs_src/tutorial/select/tutorial003_py310.py ln[34:39] hl[34:39] *} +{* ./docs_src/tutorial/select/tutorial003.py ln[34:39] hl[34:39] *} But this would get us **all** the heroes at the same time, in a database that could have thousands, that could be problematic. @@ -28,7 +28,7 @@ But this would get us **all** the heroes at the same time, in a database that co We currently have 7 heroes in the database. But we could as well have thousands, so let's limit the results to get only the first 3: -{* ./docs_src/tutorial/offset_and_limit/tutorial001_py310.py ln[42:47] hl[44] *} +{* ./docs_src/tutorial/offset_and_limit/tutorial001.py ln[42:47] hl[44] *} The special **select** object we get from `select()` also has a method `.limit()` that we can use to limit the results to a certain number. @@ -91,7 +91,7 @@ How do we get the next 3? We can use `.offset()`: -{* ./docs_src/tutorial/offset_and_limit/tutorial002_py310.py ln[42:47] hl[44] *} +{* ./docs_src/tutorial/offset_and_limit/tutorial002.py ln[42:47] hl[44] *} The way this works is that the special **select** object we get from `select()` has methods like `.where()`, `.offset()` and `.limit()`. @@ -130,7 +130,7 @@ INFO Engine [no key 0.00020s] (3, 3) Then to get the next batch of 3 rows we would offset all the ones we already saw, the first 6: -{* ./docs_src/tutorial/offset_and_limit/tutorial003_py310.py ln[42:47] hl[44] *} +{* ./docs_src/tutorial/offset_and_limit/tutorial003.py ln[42:47] hl[44] *} The database right now has **only 7 rows**, so this query can only get 1 row. @@ -185,7 +185,7 @@ If you try that in **DB Browser for SQLite**, you will get the same result: Of course, you can also combine `.limit()` and `.offset()` with `.where()` and other methods you will learn about later: -{* ./docs_src/tutorial/offset_and_limit/tutorial004_py310.py ln[42:47] hl[44] *} +{* ./docs_src/tutorial/offset_and_limit/tutorial004.py ln[42:47] hl[44] *} ## Run the Program with Limit, Offset, and Where on the Command Line diff --git a/docs/tutorial/many-to-many/create-data.md b/docs/tutorial/many-to-many/create-data.md index c275ba217d..1b2e70bd45 100644 --- a/docs/tutorial/many-to-many/create-data.md +++ b/docs/tutorial/many-to-many/create-data.md @@ -8,13 +8,13 @@ We'll create data for this same **many-to-many** relationship with a link table: We'll continue from where we left off with the previous code. -{* ./docs_src/tutorial/many_to_many/tutorial001_py310.py ln[0] *} +{* ./docs_src/tutorial/many_to_many/tutorial001.py ln[0] *} ## Create Heroes As we have done before, we'll create a function `create_heroes()` and we'll create some teams and heroes in it: -{* ./docs_src/tutorial/many_to_many/tutorial001_py310.py ln[36:54] hl[44] *} +{* ./docs_src/tutorial/many_to_many/tutorial001.py ln[36:54] hl[44] *} This is very similar to what we have done before. @@ -28,13 +28,13 @@ See how **Deadpond** now belongs to the two teams? Now let's do as we have done before, `commit` the **session**, `refresh` the data, and print it: -{* ./docs_src/tutorial/many_to_many/tutorial001_py310.py ln[36:69] hl[55:58,60:62,64:69] *} +{* ./docs_src/tutorial/many_to_many/tutorial001.py ln[36:69] hl[55:58,60:62,64:69] *} ## Add to Main As before, add the `create_heroes()` function to the `main()` function to make sure it is called when running this program from the command line: -{* ./docs_src/tutorial/many_to_many/tutorial001_py310.py ln[72:74] *} +{* ./docs_src/tutorial/many_to_many/tutorial001.py ln[72:74] *} ## Run the Program diff --git a/docs/tutorial/many-to-many/create-models-with-link.md b/docs/tutorial/many-to-many/create-models-with-link.md index 34fbd3b2f9..b474c644f2 100644 --- a/docs/tutorial/many-to-many/create-models-with-link.md +++ b/docs/tutorial/many-to-many/create-models-with-link.md @@ -12,7 +12,7 @@ As we want to support a **many-to-many** relationship, now we need a **link tabl We can create it just as any other **SQLModel**: -{* ./docs_src/tutorial/many_to_many/tutorial001_py310.py ln[1:6] hl[4:6] *} +{* ./docs_src/tutorial/many_to_many/tutorial001.py ln[1:6] hl[4:6] *} This is a **SQLModel** class model table like any other. @@ -26,7 +26,7 @@ And **both fields are primary keys**. We hadn't used this before. 🤓 Let's see the `Team` model, it's almost identical to the previous version, but with a little change: -{* ./docs_src/tutorial/many_to_many/tutorial001_py310.py ln[9:14] hl[14] *} +{* ./docs_src/tutorial/many_to_many/tutorial001.py ln[9:14] hl[14] *} The **relationship attribute `heroes`** is still a list of heroes, annotated as `list["Hero"]`. Again, we use `"Hero"` in quotes because we haven't declared that class yet by this point in the code (but as you know, editors and **SQLModel** understand that). @@ -40,7 +40,7 @@ And here's the important part to allow the **many-to-many** relationship, we use Let's see the other side, here's the `Hero` model: -{* ./docs_src/tutorial/many_to_many/tutorial001_py310.py ln[17:23] hl[23] *} +{* ./docs_src/tutorial/many_to_many/tutorial001.py ln[17:23] hl[23] *} We **removed** the previous `team_id` field (column) because now the relationship is done via the link table. 🔥 @@ -58,11 +58,11 @@ And now we have a **`link_model=HeroTeamLink`**. ✨ The same as before, we will have the rest of the code to create the **engine**, and a function to create all the tables `create_db_and_tables()`. -{* ./docs_src/tutorial/many_to_many/tutorial001_py310.py ln[26:33] hl[32] *} +{* ./docs_src/tutorial/many_to_many/tutorial001.py ln[26:33] hl[32] *} And as in previous examples, we will add that function to a function `main()`, and we will call that `main()` function in the main block: -{* ./docs_src/tutorial/many_to_many/tutorial001_py310.py ln[72:73,77:78] hl[73] *} +{* ./docs_src/tutorial/many_to_many/tutorial001.py ln[72:73,77:78] hl[73] *} ## Run the Code diff --git a/docs/tutorial/many-to-many/link-with-extra-fields.md b/docs/tutorial/many-to-many/link-with-extra-fields.md index b44dbb5ebe..379f85527c 100644 --- a/docs/tutorial/many-to-many/link-with-extra-fields.md +++ b/docs/tutorial/many-to-many/link-with-extra-fields.md @@ -32,7 +32,7 @@ We will add a new field `is_training`. And we will also add two **relationship attributes**, for the linked `team` and `hero`: -{* ./docs_src/tutorial/many_to_many/tutorial003_py310.py ln[4:10] hl[7,9:10] *} +{* ./docs_src/tutorial/many_to_many/tutorial003.py ln[4:10] hl[7,9:10] *} The new **relationship attributes** have their own `back_populates` pointing to new relationship attributes we will create in the `Hero` and `Team` models: @@ -53,7 +53,7 @@ Now let's update the `Team` model. We no longer have the `heroes` relationship attribute, and instead we have the new `hero_links` attribute: -{* ./docs_src/tutorial/many_to_many/tutorial003_py310.py ln[13:18] hl[18] *} +{* ./docs_src/tutorial/many_to_many/tutorial003.py ln[13:18] hl[18] *} ## Update Hero Model @@ -61,7 +61,7 @@ The same with the `Hero` model. We change the `teams` relationship attribute to `team_links`: -{* ./docs_src/tutorial/many_to_many/tutorial003_py310.py ln[21:27] hl[27] *} +{* ./docs_src/tutorial/many_to_many/tutorial003.py ln[21:27] hl[27] *} ## Create Relationships @@ -69,7 +69,7 @@ Now the process to create relationships is very similar. But now we create the **explicit link models** manually, pointing to their hero and team instances, and specifying the additional link data (`is_training`): -{* ./docs_src/tutorial/many_to_many/tutorial003_py310.py ln[40:79] hl[58:67,69:72] *} +{* ./docs_src/tutorial/many_to_many/tutorial003.py ln[40:79] hl[58:67,69:72] *} We are just adding the link model instances to the session, because the link model instances are connected to the heroes and teams, they will also be automatically included in the session when we commit. @@ -167,7 +167,7 @@ Now, to add a new relationship, we have to create a new `HeroTeamLink` instance Here we do that in the `update_heroes()` function: -{* ./docs_src/tutorial/many_to_many/tutorial003_py310.py ln[82:97] hl[89:94] *} +{* ./docs_src/tutorial/many_to_many/tutorial003.py ln[82:97] hl[89:94] *} ## Run the Program with the New Relationship @@ -248,7 +248,7 @@ So now we want to update the status of `is_training` to `False`. We can do that by iterating on the links: -{* ./docs_src/tutorial/many_to_many/tutorial003_py310.py ln[82:83,99:107] hl[99:101] *} +{* ./docs_src/tutorial/many_to_many/tutorial003.py ln[82:83,99:107] hl[99:101] *} ## Run the Program with the Updated Relationships diff --git a/docs/tutorial/many-to-many/update-remove-relationships.md b/docs/tutorial/many-to-many/update-remove-relationships.md index a2a15aa645..45d1d6e019 100644 --- a/docs/tutorial/many-to-many/update-remove-relationships.md +++ b/docs/tutorial/many-to-many/update-remove-relationships.md @@ -4,7 +4,7 @@ Now we'll see how to update and remove these **many-to-many** relationships. We'll continue from where we left off with the previous code. -{* ./docs_src/tutorial/many_to_many/tutorial001_py310.py ln[0] *} +{* ./docs_src/tutorial/many_to_many/tutorial001.py ln[0] *} ## Get Data to Update @@ -16,11 +16,11 @@ As you already know how this goes, I'll use the **short version** and get the da And because we are now using `select()`, we also have to import it. -{* ./docs_src/tutorial/many_to_many/tutorial002_py310.py ln[1,72:77] hl[1,72:77] *} +{* ./docs_src/tutorial/many_to_many/tutorial002.py ln[1,72:77] hl[1,72:77] *} And of course, we have to add `update_heroes()` to our `main()` function: -{* ./docs_src/tutorial/many_to_many/tutorial002_py310.py ln[94:101] hl[97] *} +{* ./docs_src/tutorial/many_to_many/tutorial002.py ln[94:101] hl[97] *} ## Add Many-to-Many Relationships @@ -28,7 +28,7 @@ Now let's imagine that **Spider-Boy** thinks that the **Z-Force** team is super We can use the same **relationship attributes** to include `hero_spider_boy` in the `team_z_force.heroes`. -{* ./docs_src/tutorial/many_to_many/tutorial002_py310.py ln[72:84] hl[79:81,83:84] *} +{* ./docs_src/tutorial/many_to_many/tutorial002.py ln[72:84] hl[79:81,83:84] *} /// tip @@ -113,7 +113,7 @@ Because `hero_spider_boy.teams` is just a list (a special list managed by SQLAlc In this case, we use the method `.remove()`, that takes an item and removes it from the list. -{* ./docs_src/tutorial/many_to_many/tutorial002_py310.py ln[72:91] hl[86:88,90:91] *} +{* ./docs_src/tutorial/many_to_many/tutorial002.py ln[72:91] hl[86:88,90:91] *} And this time, just to show again that by using `back_populates` **SQLModel** (actually SQLAlchemy) takes care of connecting the models by their relationships, even though we performed the operation from the `hero_spider_boy` object (modifying `hero_spider_boy.teams`), we are adding `team_z_force` to the **session**. And we commit that, without even adding `hero_spider_boy`. diff --git a/docs/tutorial/one.md b/docs/tutorial/one.md index ad181247f0..33559280f5 100644 --- a/docs/tutorial/one.md +++ b/docs/tutorial/one.md @@ -14,7 +14,7 @@ Let's see the utilities to read a single row. We'll continue with the same examples we have been using in the previous chapters to create and select data and we'll keep updating them. -{* ./docs_src/tutorial/indexes/tutorial002_py310.py ln[0] *} +{* ./docs_src/tutorial/indexes/tutorial002.py ln[0] *} If you already executed the previous examples and have a database with data, **remove the database file** before running each example, that way you won't have duplicate data and you will be able to get the same results. @@ -22,13 +22,13 @@ If you already executed the previous examples and have a database with data, **r We have been iterating over the rows in a `result` object like: -{* ./docs_src/tutorial/indexes/tutorial002_py310.py ln[42:47] hl[46:47] *} +{* ./docs_src/tutorial/indexes/tutorial002.py ln[42:47] hl[46:47] *} But let's say that we are not interested in all the rows, just the **first** one. We can call the `.first()` method on the `results` object to get the first row: -{* ./docs_src/tutorial/one/tutorial001_py310.py ln[42:47] hl[46] *} +{* ./docs_src/tutorial/one/tutorial001.py ln[42:47] hl[46] *} This will return the first object in the `results` (if there was any). @@ -69,7 +69,7 @@ It would be possible that the SQL query doesn't find any row. In that case, `.first()` will return `None`: -{* ./docs_src/tutorial/one/tutorial002_py310.py ln[42:47] hl[44,46] *} +{* ./docs_src/tutorial/one/tutorial002.py ln[42:47] hl[44,46] *} In this case, as there's no hero with an age less than 25, `.first()` will return `None`. @@ -102,7 +102,7 @@ And if there was more than one, it would mean that there's an error in the syste In that case, instead of `.first()` we can use `.one()`: -{* ./docs_src/tutorial/one/tutorial003_py310.py ln[42:47] hl[46] *} +{* ./docs_src/tutorial/one/tutorial003.py ln[42:47] hl[46] *} Here we know that there's only one `"Deadpond"`, and there shouldn't be any more than one. @@ -158,7 +158,7 @@ sqlalchemy.exc.MultipleResultsFound: Multiple rows were found when exactly one w Of course, even if we don't duplicate the data, we could get the same error if we send a query that finds more than one row and expect exactly one with `.one()`: -{* ./docs_src/tutorial/one/tutorial004_py310.py ln[42:47] hl[44,46] *} +{* ./docs_src/tutorial/one/tutorial004.py ln[42:47] hl[44,46] *} That would find 2 rows, and would end up with the same error. @@ -166,7 +166,7 @@ That would find 2 rows, and would end up with the same error. And also, if we get no rows at all with `.one()`, it will also raise an error: -{* ./docs_src/tutorial/one/tutorial005_py310.py ln[42:47] hl[44,46] *} +{* ./docs_src/tutorial/one/tutorial005.py ln[42:47] hl[44,46] *} In this case, as there are no heroes with an age less than 25, `.one()` will raise an error. @@ -199,7 +199,7 @@ sqlalchemy.exc.NoResultFound: No row was found when one was required Of course, with `.first()` and `.one()` you would also probably write all that in a more compact form most of the time, all in a single line (or at least a single Python statement): -{* ./docs_src/tutorial/one/tutorial006_py310.py ln[42:45] hl[44] *} +{* ./docs_src/tutorial/one/tutorial006.py ln[42:45] hl[44] *} That would result in the same as some examples above. @@ -209,7 +209,7 @@ In many cases you might want to select a single row by its Id column with the ** You could do it the same way we have been doing with a `.where()` and then getting the first item with `.first()`: -{* ./docs_src/tutorial/one/tutorial007_py310.py ln[42:47] hl[44,46] *} +{* ./docs_src/tutorial/one/tutorial007.py ln[42:47] hl[44,46] *} That would work correctly, as expected. But there's a shorter version. 👇 @@ -217,7 +217,7 @@ That would work correctly, as expected. But there's a shorter version. 👇 As selecting a single row by its Id column with the **primary key** is a common operation, there's a shortcut for it: -{* ./docs_src/tutorial/one/tutorial008_py310.py ln[42:45] hl[44] *} +{* ./docs_src/tutorial/one/tutorial008.py ln[42:45] hl[44] *} `session.get(Hero, 1)` is equivalent to creating a `select()`, then filtering by Id using `.where()`, and then getting the first item with `.first()`. @@ -246,7 +246,7 @@ Hero: secret_name='Dive Wilson' age=None id=1 name='Deadpond' `.get()` behaves similarly to `.first()`, if there's no data it will simply return `None` (instead of raising an error): -{* ./docs_src/tutorial/one/tutorial009_py310.py ln[42:45] hl[44] *} +{* ./docs_src/tutorial/one/tutorial009.py ln[42:45] hl[44] *} Running that will output: diff --git a/docs/tutorial/relationship-attributes/back-populates.md b/docs/tutorial/relationship-attributes/back-populates.md index 63082c6132..3c230ca768 100644 --- a/docs/tutorial/relationship-attributes/back-populates.md +++ b/docs/tutorial/relationship-attributes/back-populates.md @@ -20,7 +20,7 @@ Let's understand that better with an example. Let's see how that works by writing an **incomplete** version first, without `back_populates`: -{* ./docs_src/tutorial/relationship_attributes/back_populates/tutorial001_py310.py ln[1:19] hl[9,19] *} +{* ./docs_src/tutorial/relationship_attributes/back_populates/tutorial001.py ln[1:19] hl[9,19] *} ## Read Data Objects @@ -28,7 +28,7 @@ Now, we will get the **Spider-Boy** hero and, *independently*, the **Preventers* As you already know how this works, I won't separate that into a select `statement`, `results`, etc. Let's use the shorter form in a single call: -{* ./docs_src/tutorial/relationship_attributes/back_populates/tutorial001_py310.py ln[103:111] hl[105:107,109:111] *} +{* ./docs_src/tutorial/relationship_attributes/back_populates/tutorial001.py ln[103:111] hl[105:107,109:111] *} /// tip @@ -40,7 +40,7 @@ When writing your own code, this is probably the style you will use most often, Now, let's print the current **Spider-Boy**, the current **Preventers** team, and particularly, the current **Preventers** list of heroes: -{* ./docs_src/tutorial/relationship_attributes/back_populates/tutorial001_py310.py ln[103:115] hl[113:115] *} +{* ./docs_src/tutorial/relationship_attributes/back_populates/tutorial001.py ln[103:115] hl[113:115] *} Up to this point, it's all good. 😊 @@ -62,7 +62,7 @@ Notice that we have **Spider-Boy** there. Now let's update **Spider-Boy**, removing him from the team by setting `hero_spider_boy.team = None` and then let's print this object again: -{* ./docs_src/tutorial/relationship_attributes/back_populates/tutorial001_py310.py ln[103:104,117:121] hl[117,121] *} +{* ./docs_src/tutorial/relationship_attributes/back_populates/tutorial001.py ln[103:104,117:121] hl[117,121] *} The first important thing is, we *haven't committed* the hero yet, so accessing the list of heroes would not trigger an automatic refresh. @@ -102,7 +102,7 @@ Oh, no! 😱 **Spider-Boy** is still listed there! Now, if we commit it and print again: -{* ./docs_src/tutorial/relationship_attributes/back_populates/tutorial001_py310.py ln[103:104,123:130] hl[123:124,130] *} +{* ./docs_src/tutorial/relationship_attributes/back_populates/tutorial001.py ln[103:104,123:130] hl[123:124,130] *} When we access `preventers_team.heroes` after the `commit`, that triggers a refresh, so we get the latest list, without **Spider-Boy**, so that's fine again: @@ -134,11 +134,11 @@ That's what `back_populates` is for. ✨ Let's add it back: -{* ./docs_src/tutorial/relationship_attributes/back_populates/tutorial002_py310.py ln[1:19] hl[9,19] *} +{* ./docs_src/tutorial/relationship_attributes/back_populates/tutorial002.py ln[1:19] hl[9,19] *} And we can keep the rest of the code the same: -{* ./docs_src/tutorial/relationship_attributes/back_populates/tutorial002_py310.py ln[103:104,117:121] hl[117,121] *} +{* ./docs_src/tutorial/relationship_attributes/back_populates/tutorial002.py ln[103:104,117:121] hl[117,121] *} /// tip @@ -171,7 +171,7 @@ Now that you know why `back_populates` is there, let's review the exact value ag It's quite simple code, it's just a string, but it might be confusing to think exactly *what* string should go there: -{* ./docs_src/tutorial/relationship_attributes/back_populates/tutorial002_py310.py ln[1:19] hl[9,19] *} +{* ./docs_src/tutorial/relationship_attributes/back_populates/tutorial002.py ln[1:19] hl[9,19] *} The string in `back_populates` is the name of the attribute *in the other* model, that will reference *the current* model. @@ -179,7 +179,7 @@ The string in `back_populates` is the name of the attribute *in the other* model So, in the class `Team`, we have an attribute `heroes` and we declare it with `Relationship(back_populates="team")`. -{* ./docs_src/tutorial/relationship_attributes/back_populates/tutorial002_py310.py ln[4:9] hl[9] *} +{* ./docs_src/tutorial/relationship_attributes/back_populates/tutorial002.py ln[4:9] hl[9] *} The string in `back_populates="team"` refers to the attribute `team` in the class `Hero` (the other class). @@ -187,7 +187,7 @@ And, in the class `Hero`, we declare an attribute `team`, and we declare it with So, the string `"heroes"` refers to the attribute `heroes` in the class `Team`. -{* ./docs_src/tutorial/relationship_attributes/back_populates/tutorial002_py310.py ln[12:19] hl[19] *} +{* ./docs_src/tutorial/relationship_attributes/back_populates/tutorial002.py ln[12:19] hl[19] *} /// tip @@ -212,4 +212,4 @@ So, `back_populates` would most probably be something like `"hero"` or `"heroes" -{* ./docs_src/tutorial/relationship_attributes/back_populates/tutorial003_py310.py ln[27:39] hl[27,34,37,39] *} +{* ./docs_src/tutorial/relationship_attributes/back_populates/tutorial003.py ln[27:39] hl[27,34,37,39] *} diff --git a/docs/tutorial/relationship-attributes/cascade-delete-relationships.md b/docs/tutorial/relationship-attributes/cascade-delete-relationships.md index c87c137a57..abccaa2c20 100644 --- a/docs/tutorial/relationship-attributes/cascade-delete-relationships.md +++ b/docs/tutorial/relationship-attributes/cascade-delete-relationships.md @@ -109,7 +109,7 @@ When creating a `Relationship()`, we can set `cascade_delete=True`. This configures SQLModel to **automatically delete** the related records (heroes) **when the initial one is deleted** (a team). -{* ./docs_src/tutorial/relationship_attributes/cascade_delete_relationships/tutorial001_py310.py ln[1:9] hl[9] *} +{* ./docs_src/tutorial/relationship_attributes/cascade_delete_relationships/tutorial001.py ln[1:9] hl[9] *} With this configuration, when we delete a team, SQLModel (actually SQLAlchemy) will: @@ -155,7 +155,7 @@ The `ondelete` parameter will set a SQL `ON DELETE` in the **foreign key column* If we want to configure the database to **automatically delete** the related records when the parent is deleted, we can set `ondelete="CASCADE"`. -{* ./docs_src/tutorial/relationship_attributes/cascade_delete_relationships/tutorial001_py310.py ln[1:19] hl[18] *} +{* ./docs_src/tutorial/relationship_attributes/cascade_delete_relationships/tutorial001.py ln[1:19] hl[18] *} Now, when we **create the tables** in the database, the `team_id` column in the `Hero` table will have an `ON DELETE CASCADE` in its definition at the database level. @@ -219,7 +219,7 @@ class Team(SQLModel, table=True): Now, when we **delete a team**, we don't need to do anything else, it's **automatically** going to **delete its heroes**. -{* ./docs_src/tutorial/relationship_attributes/cascade_delete_relationships/tutorial001_py310.py ln[76:82] hl[80] *} +{* ./docs_src/tutorial/relationship_attributes/cascade_delete_relationships/tutorial001.py ln[76:82] hl[80] *} ## Confirm Heroes are Deleted @@ -227,7 +227,7 @@ We can confirm that **after deleting the team** `Wakaland`, the heroes `Black Li If we try to select them from the database, we will **no longer find them**. -{* ./docs_src/tutorial/relationship_attributes/cascade_delete_relationships/tutorial001_py310.py ln[85:95] hl[87,90,92,95] *} +{* ./docs_src/tutorial/relationship_attributes/cascade_delete_relationships/tutorial001.py ln[85:95] hl[87,90,92,95] *} ## Run the Program with `cascade_delete=True` and `ondelete="CASCADE"` @@ -297,7 +297,7 @@ We can configure the database to **set the foreign key** (the `team_id` in the ` In this case, the side with `Relationship()` won't have `cascade_delete`, but the side with `Field()` and a `foreign_key` will have `ondelete="SET NULL"`. -{* ./docs_src/tutorial/relationship_attributes/cascade_delete_relationships/tutorial002_py310.py ln[1:21] hl[19] *} +{* ./docs_src/tutorial/relationship_attributes/cascade_delete_relationships/tutorial002.py ln[1:21] hl[19] *} The configuration above is setting the `team_id` column from the `Hero` table to have an `ON DELETE SET NULL`. @@ -333,7 +333,7 @@ But if you delete a team from code, by default, SQLModel (actually SQLAlchemy) w Removing a team has the **same code** as before, the only thing that changes is the configuration underneath in the database. -{* ./docs_src/tutorial/relationship_attributes/cascade_delete_relationships/tutorial002_py310.py ln[78:84] hl[82] *} +{* ./docs_src/tutorial/relationship_attributes/cascade_delete_relationships/tutorial002.py ln[78:84] hl[82] *} The result would be these tables. @@ -438,7 +438,7 @@ If you know your database would be able to correctly handle the deletes or updat To be able to test this out with SQLite, we first need to enable foreign key support. -{* ./docs_src/tutorial/relationship_attributes/cascade_delete_relationships/tutorial003_py310.py ln[30:34] hl[32,34] *} +{* ./docs_src/tutorial/relationship_attributes/cascade_delete_relationships/tutorial003.py ln[30:34] hl[32,34] *} /// note @@ -452,7 +452,7 @@ Now let's update the table model for `Team` to use `passive_deletes="all"` in th We will also use `ondelete="SET NULL"` in the `Hero` model table, in the foreign key `Field()` for the `team_id` to make the database set those fields to `NULL` automatically. -{* ./docs_src/tutorial/relationship_attributes/cascade_delete_relationships/tutorial003_py310.py ln[1:21] hl[9,19] *} +{* ./docs_src/tutorial/relationship_attributes/cascade_delete_relationships/tutorial003.py ln[1:21] hl[9,19] *} ### Run the Program with `passive_deletes` @@ -516,7 +516,7 @@ For SQLite, this also needs enabling foreign key support. As `ondelete="RESTRICT"` is mainly a database-level constraint, let's enable foreign key support in SQLite first to be able to test it. -{* ./docs_src/tutorial/relationship_attributes/cascade_delete_relationships/tutorial004_py310.py ln[30:34] hl[32,34] *} +{* ./docs_src/tutorial/relationship_attributes/cascade_delete_relationships/tutorial004.py ln[30:34] hl[32,34] *} ### Use `ondelete="RESTRICT"` @@ -530,7 +530,7 @@ Notice that we don't set `cascade_delete` in the `Team` model table. /// -{* ./docs_src/tutorial/relationship_attributes/cascade_delete_relationships/tutorial004_py310.py ln[1:21] hl[9,19] *} +{* ./docs_src/tutorial/relationship_attributes/cascade_delete_relationships/tutorial004.py ln[1:21] hl[9,19] *} ### Run the Program with `RESTRICT`, See the Error @@ -593,7 +593,7 @@ Calling `team.heroes.clear()` is very similar to what SQLModel (actually SQLAlch /// -{* ./docs_src/tutorial/relationship_attributes/cascade_delete_relationships/tutorial005_py310.py ln[81:89] hl[85] *} +{* ./docs_src/tutorial/relationship_attributes/cascade_delete_relationships/tutorial005.py ln[81:89] hl[85] *} ### Run the Program Deleting Heroes First diff --git a/docs/tutorial/relationship-attributes/create-and-update-relationships.md b/docs/tutorial/relationship-attributes/create-and-update-relationships.md index d0de56735d..a398c52a03 100644 --- a/docs/tutorial/relationship-attributes/create-and-update-relationships.md +++ b/docs/tutorial/relationship-attributes/create-and-update-relationships.md @@ -6,7 +6,7 @@ Let's see now how to create data with relationships using these new **relationsh Let's check the old code we used to create some heroes and teams: -{* ./docs_src/tutorial/connect/insert/tutorial001_py310.py ln[29:58] hl[35,38,44,50] *} +{* ./docs_src/tutorial/connect/insert/tutorial001.py ln[29:58] hl[35,38,44,50] *} There are several things to **notice** here. @@ -26,7 +26,7 @@ This is the first area where these **relationship attributes** can help. 🤓 Now let's do all that, but this time using the new, shiny `Relationship` attributes: -{* ./docs_src/tutorial/relationship_attributes/define_relationship_attributes/tutorial001_py310.py ln[32:55] hl[38,41,47] *} +{* ./docs_src/tutorial/relationship_attributes/define_relationship_attributes/tutorial001.py ln[32:55] hl[38,41,47] *} Now we can create the `Team` instances and pass them directly to the new `team` argument when creating the `Hero` instances, as `team=team_preventers` instead of `team_id=team_preventers.id`. @@ -42,7 +42,7 @@ And then, as you can see, we only have to do one `commit()`. The same way we could assign an integer with a `team.id` to a `hero.team_id`, we can also assign the `Team` instance to the `hero.team`: -{* ./docs_src/tutorial/relationship_attributes/create_and_update_relationships/tutorial001_py310.py ln[32:33,57:61] hl[57] *} +{* ./docs_src/tutorial/relationship_attributes/create_and_update_relationships/tutorial001.py ln[32:33,57:61] hl[57] *} ## Create a Team with Heroes @@ -50,7 +50,7 @@ Before, we created some `Team` instances and passed them in the `team=` argument We could also create the `Hero` instances first, and then pass them in the `heroes=` argument that takes a list, when creating a `Team` instance: -{* ./docs_src/tutorial/relationship_attributes/create_and_update_relationships/tutorial001_py310.py ln[32:33,63:73] hl[68,70:71] *} +{* ./docs_src/tutorial/relationship_attributes/create_and_update_relationships/tutorial001.py ln[32:33,63:73] hl[68,70:71] *} Here we create two heroes first, **Black Lion** and **Princess Sure-E**, and then we pass them in the `heroes` argument. @@ -66,7 +66,7 @@ As the attribute `team.heroes` behaves like a list, we can simply append to it. Let's create some more heroes and add them to the `team_preventers.heroes` list attribute: -{* ./docs_src/tutorial/relationship_attributes/create_and_update_relationships/tutorial001_py310.py ln[32:33,75:91] hl[81:85] *} +{* ./docs_src/tutorial/relationship_attributes/create_and_update_relationships/tutorial001.py ln[32:33,75:91] hl[81:85] *} The attribute `team_preventers.heroes` behaves like a list. But it's a special type of list, because when we modify it adding heroes to it, **SQLModel** (actually SQLAlchemy) **keeps track of the necessary changes** to be done in the database. diff --git a/docs/tutorial/relationship-attributes/define-relationships-attributes.md b/docs/tutorial/relationship-attributes/define-relationships-attributes.md index 5368a82297..d3192512c4 100644 --- a/docs/tutorial/relationship-attributes/define-relationships-attributes.md +++ b/docs/tutorial/relationship-attributes/define-relationships-attributes.md @@ -41,7 +41,7 @@ Now that you know how these tables work underneath and how the model classes rep Up to now, we have only used the `team_id` column to connect the tables when querying with `select()`: -{* ./docs_src/tutorial/connect/insert/tutorial001_py310.py ln[1:16] hl[16] *} +{* ./docs_src/tutorial/connect/insert/tutorial001.py ln[1:16] hl[16] *} This is a **plain field** like all the others, all representing a **column in the table**. @@ -49,11 +49,11 @@ But now let's add a couple of new special attributes to these model classes, let First, import `Relationship` from `sqlmodel`: -{* ./docs_src/tutorial/relationship_attributes/define_relationship_attributes/tutorial001_py310.py ln[1] hl[1] *} +{* ./docs_src/tutorial/relationship_attributes/define_relationship_attributes/tutorial001.py ln[1] hl[1] *} Next, use that `Relationship` to declare a new attribute in the model classes: -{* ./docs_src/tutorial/relationship_attributes/define_relationship_attributes/tutorial001_py310.py ln[1:19] hl[9,19] *} +{* ./docs_src/tutorial/relationship_attributes/define_relationship_attributes/tutorial001.py ln[1:19] hl[9,19] *} ## What Are These Relationship Attributes diff --git a/docs/tutorial/relationship-attributes/read-relationships.md b/docs/tutorial/relationship-attributes/read-relationships.md index cfa77d92e9..e4708067d1 100644 --- a/docs/tutorial/relationship-attributes/read-relationships.md +++ b/docs/tutorial/relationship-attributes/read-relationships.md @@ -6,7 +6,7 @@ Now that we know how to connect data using **relationship attributes**, let's se First, add a function `select_heroes()` where we get a hero to start working with, and add that function to the `main()` function: -{* ./docs_src/tutorial/relationship_attributes/read_relationships/tutorial001_py310.py ln[94:98,108:111] hl[94:98,111] *} +{* ./docs_src/tutorial/relationship_attributes/read_relationships/tutorial001.py ln[94:98,108:111] hl[94:98,111] *} ## Select the Related Team - Old Way @@ -14,7 +14,7 @@ Now that we have a hero, we can get the team this hero belongs to. With what we have learned **up to now**, we could use a `select()` statement, then execute it with `session.exec()`, and then get the `.first()` result, for example: -{* ./docs_src/tutorial/relationship_attributes/read_relationships/tutorial001_py310.py ln[94:103] hl[100:103] *} +{* ./docs_src/tutorial/relationship_attributes/read_relationships/tutorial001.py ln[94:103] hl[100:103] *} ## Get Relationship Team - New Way @@ -22,7 +22,7 @@ But now that we have the **relationship attributes**, we can just access them, a So, the highlighted block above, has the same results as the block below: -{* ./docs_src/tutorial/relationship_attributes/read_relationships/tutorial001_py310.py ln[94:98,105] hl[105] *} +{* ./docs_src/tutorial/relationship_attributes/read_relationships/tutorial001.py ln[94:98,105] hl[105] *} /// tip @@ -36,7 +36,7 @@ For example, here, **inside** a `with` block with a `Session` object. And the same way, when we are working on the **many** side of the **one-to-many** relationship, we can get a list of the related objects just by accessing the relationship attribute: -{* ./docs_src/tutorial/relationship_attributes/read_relationships/tutorial002_py310.py ln[94:100] hl[100] *} +{* ./docs_src/tutorial/relationship_attributes/read_relationships/tutorial002.py ln[94:100] hl[100] *} That would print a list with all the heroes in the Preventers team: diff --git a/docs/tutorial/relationship-attributes/remove-relationships.md b/docs/tutorial/relationship-attributes/remove-relationships.md index ff408e20b9..cb10e2e1d5 100644 --- a/docs/tutorial/relationship-attributes/remove-relationships.md +++ b/docs/tutorial/relationship-attributes/remove-relationships.md @@ -8,11 +8,11 @@ And then for some reason needs to leave the **Preventers** for some years. 😭 We can remove the relationship by setting it to `None`, the same as with the `team_id`, it also works with the new relationship attribute `.team`: -{* ./docs_src/tutorial/relationship_attributes/read_relationships/tutorial002_py310.py ln[103:114] hl[109] *} +{* ./docs_src/tutorial/relationship_attributes/read_relationships/tutorial002.py ln[103:114] hl[109] *} And of course, we should remember to add this `update_heroes()` function to `main()` so that it runs when we call this program from the command line: -{* ./docs_src/tutorial/relationship_attributes/read_relationships/tutorial002_py310.py ln[117:121] hl[121] *} +{* ./docs_src/tutorial/relationship_attributes/read_relationships/tutorial002.py ln[117:121] hl[121] *} ## Recap diff --git a/docs/tutorial/relationship-attributes/type-annotation-strings.md b/docs/tutorial/relationship-attributes/type-annotation-strings.md index ca81141683..ab4f91bd09 100644 --- a/docs/tutorial/relationship-attributes/type-annotation-strings.md +++ b/docs/tutorial/relationship-attributes/type-annotation-strings.md @@ -2,7 +2,7 @@ In the first Relationship attribute, we declare it with `list["Hero"]`, putting the `Hero` in quotes instead of just normally there: -{* ./docs_src/tutorial/relationship_attributes/define_relationship_attributes/tutorial001_py310.py ln[1:19] hl[9] *} +{* ./docs_src/tutorial/relationship_attributes/define_relationship_attributes/tutorial001.py ln[1:19] hl[9] *} What's that about? Can't we just write it normally as `list[Hero]`? diff --git a/docs/tutorial/select.md b/docs/tutorial/select.md index 89a900626e..96a1e263a7 100644 --- a/docs/tutorial/select.md +++ b/docs/tutorial/select.md @@ -23,7 +23,7 @@ Things are getting more exciting! Let's now see how to read data from the databa Let's continue from the last code we used to create some data. -{* ./docs_src/tutorial/insert/tutorial002_py310.py ln[0] *} +{* ./docs_src/tutorial/insert/tutorial002.py ln[0] *} We are creating a **SQLModel** `Hero` class model and creating some records. @@ -160,7 +160,7 @@ The first step is to create a **Session**, the same way we did when creating the We will start with that in a new function `select_heroes()`: -{* ./docs_src/tutorial/select/tutorial001_py310.py ln[34:35] hl[34:35] *} +{* ./docs_src/tutorial/select/tutorial001.py ln[34:35] hl[34:35] *} ## Create a `select` Statement @@ -168,11 +168,11 @@ Next, pretty much the same way we wrote a SQL `SELECT` statement above, now we'l First we have to import `select` from `sqlmodel` at the top of the file: -{* ./docs_src/tutorial/select/tutorial001_py310.py ln[1] hl[1] *} +{* ./docs_src/tutorial/select/tutorial001.py ln[1] hl[1] *} And then we will use it to create a `SELECT` statement in Python code: -{* ./docs_src/tutorial/select/tutorial001_py310.py ln[1,34:36] hl[36] *} +{* ./docs_src/tutorial/select/tutorial001.py ln[1,34:36] hl[36] *} It's a very simple line of code that conveys a lot of information: @@ -203,7 +203,7 @@ I'll tell you about that in the next chapters. Now that we have the `select` statement, we can execute it with the **session**: -{* ./docs_src/tutorial/select/tutorial001_py310.py ln[34:37] hl[37] *} +{* ./docs_src/tutorial/select/tutorial001.py ln[34:37] hl[37] *} This will tell the **session** to go ahead and use the **engine** to execute that `SELECT` statement in the database and bring the results back. @@ -241,7 +241,7 @@ The `results` object is an ` to get the rows where a column is **more than** a value: -{* ./docs_src/tutorial/where/tutorial003_py310.py ln[42:47] hl[44] *} +{* ./docs_src/tutorial/where/tutorial003.py ln[42:47] hl[44] *} That would output: @@ -525,7 +525,7 @@ Notice that it didn't select `Black Lion`, because the age is not *strictly* gre Let's do that again, but with `>=` to get the rows where a column is **more than or equal** to a value: -{* ./docs_src/tutorial/where/tutorial004_py310.py ln[42:47] hl[44] *} +{* ./docs_src/tutorial/where/tutorial004.py ln[42:47] hl[44] *} Because we are using `>=`, the age `35` will be included in the output: @@ -546,7 +546,7 @@ This time we got `Black Lion` too because although the age is not *strictly* gre Similarly, we can use `<` to get the rows where a column is **less than** a value: -{* ./docs_src/tutorial/where/tutorial005_py310.py ln[42:47] hl[44] *} +{* ./docs_src/tutorial/where/tutorial005.py ln[42:47] hl[44] *} And we get the youngest one with an age in the database: @@ -564,7 +564,7 @@ We could imagine that **Spider-Boy** is even **younger**. But because we don't k We can also use `<=` to get the rows where a column is **less than or equal** to a value: -{* ./docs_src/tutorial/where/tutorial006_py310.py ln[42:47] hl[44] *} +{* ./docs_src/tutorial/where/tutorial006.py ln[42:47] hl[44] *} And we get the younger ones, `35` and below: @@ -583,7 +583,7 @@ We get `Black Lion` here too because although the age is not *strictly* less tha Finally, we can use `in_` to get the rows where a column is a member of a collection of values: -{* ./docs_src/tutorial/where/tutorial006b_py310.py ln[42:47] hl[44] *} +{* ./docs_src/tutorial/where/tutorial006b.py ln[42:47] hl[44] *} In this case, we match `Deadpond` since it's part of the collection of names. We don't have any hero called `Ratman`, so it does not match any hero. @@ -605,7 +605,7 @@ We can use the same standard Python comparison operators like `<`, `<=`, `>`, `> Because `.where()` returns the same special select object back, we can add more `.where()` calls to it: -{* ./docs_src/tutorial/where/tutorial007_py310.py ln[42:47] hl[44] *} +{* ./docs_src/tutorial/where/tutorial007.py ln[42:47] hl[44] *} This will select the rows `WHERE` the `age` is **greater than or equal** to `35`, `AND` also the `age` is **less than** `40`. @@ -646,7 +646,7 @@ age=36 id=6 name='Dr. Weird' secret_name='Steve Weird' As an alternative to using multiple `.where()` we can also pass several expressions to a single `.where()`: -{* ./docs_src/tutorial/where/tutorial008_py310.py ln[42:47] hl[44] *} +{* ./docs_src/tutorial/where/tutorial008.py ln[42:47] hl[44] *} This is the same as the above, and will result in the same output with the two heroes: @@ -663,13 +663,13 @@ But we can also combine expressions using `OR`. Which means that **any** (but no To do it, you can import `or_`: -{* ./docs_src/tutorial/where/tutorial009_py310.py ln[1] hl[1] *} +{* ./docs_src/tutorial/where/tutorial009.py ln[1] hl[1] *} And then pass both expressions to `or_()` and put it inside `.where()`. For example, here we select the heroes that are the youngest OR the oldest: -{* ./docs_src/tutorial/where/tutorial009_py310.py ln[42:47] hl[44] *} +{* ./docs_src/tutorial/where/tutorial009.py ln[42:47] hl[44] *} When we run it, this generates the output: @@ -720,11 +720,11 @@ We can tell the editor that this class attribute is actually a special **SQLMode To do that, we can import `col()` (as short for "column"): -{* ./docs_src/tutorial/where/tutorial011_py310.py ln[1] hl[1] *} +{* ./docs_src/tutorial/where/tutorial011.py ln[1] hl[1] *} And then put the **class attribute** inside `col()` when using it in a `.where()`: -{* ./docs_src/tutorial/where/tutorial011_py310.py ln[42:47] hl[44] *} +{* ./docs_src/tutorial/where/tutorial011.py ln[42:47] hl[44] *} So, now the comparison is not: diff --git a/docs_src/advanced/datetime/tutorial002_py310.py b/docs_src/advanced/datetime/tutorial002.py similarity index 100% rename from docs_src/advanced/datetime/tutorial002_py310.py rename to docs_src/advanced/datetime/tutorial002.py diff --git a/docs_src/advanced/datetime/tutorial003_py310.py b/docs_src/advanced/datetime/tutorial003.py similarity index 100% rename from docs_src/advanced/datetime/tutorial003_py310.py rename to docs_src/advanced/datetime/tutorial003.py diff --git a/docs_src/advanced/datetime/tutorial004_py310.py b/docs_src/advanced/datetime/tutorial004.py similarity index 100% rename from docs_src/advanced/datetime/tutorial004_py310.py rename to docs_src/advanced/datetime/tutorial004.py diff --git a/docs_src/advanced/datetime/tutorial005_py310.py b/docs_src/advanced/datetime/tutorial005.py similarity index 100% rename from docs_src/advanced/datetime/tutorial005_py310.py rename to docs_src/advanced/datetime/tutorial005.py diff --git a/docs_src/advanced/decimal/tutorial001_py310.py b/docs_src/advanced/decimal/tutorial001.py similarity index 100% rename from docs_src/advanced/decimal/tutorial001_py310.py rename to docs_src/advanced/decimal/tutorial001.py diff --git a/docs_src/advanced/uuid/tutorial001_py310.py b/docs_src/advanced/uuid/tutorial001.py similarity index 100% rename from docs_src/advanced/uuid/tutorial001_py310.py rename to docs_src/advanced/uuid/tutorial001.py diff --git a/docs_src/advanced/uuid/tutorial002_py310.py b/docs_src/advanced/uuid/tutorial002.py similarity index 100% rename from docs_src/advanced/uuid/tutorial002_py310.py rename to docs_src/advanced/uuid/tutorial002.py diff --git a/docs_src/tutorial/automatic_id_none_refresh/tutorial001_py310.py b/docs_src/tutorial/automatic_id_none_refresh/tutorial001.py similarity index 100% rename from docs_src/tutorial/automatic_id_none_refresh/tutorial001_py310.py rename to docs_src/tutorial/automatic_id_none_refresh/tutorial001.py diff --git a/docs_src/tutorial/automatic_id_none_refresh/tutorial002_py310.py b/docs_src/tutorial/automatic_id_none_refresh/tutorial002.py similarity index 100% rename from docs_src/tutorial/automatic_id_none_refresh/tutorial002_py310.py rename to docs_src/tutorial/automatic_id_none_refresh/tutorial002.py diff --git a/docs_src/tutorial/code_structure/tutorial001_py310/__init__.py b/docs_src/tutorial/code_structure/tutorial001/__init__.py similarity index 100% rename from docs_src/tutorial/code_structure/tutorial001_py310/__init__.py rename to docs_src/tutorial/code_structure/tutorial001/__init__.py diff --git a/docs_src/tutorial/code_structure/tutorial001_py310/app.py b/docs_src/tutorial/code_structure/tutorial001/app.py similarity index 100% rename from docs_src/tutorial/code_structure/tutorial001_py310/app.py rename to docs_src/tutorial/code_structure/tutorial001/app.py diff --git a/docs_src/tutorial/code_structure/tutorial001_py310/database.py b/docs_src/tutorial/code_structure/tutorial001/database.py similarity index 100% rename from docs_src/tutorial/code_structure/tutorial001_py310/database.py rename to docs_src/tutorial/code_structure/tutorial001/database.py diff --git a/docs_src/tutorial/code_structure/tutorial001_py310/models.py b/docs_src/tutorial/code_structure/tutorial001/models.py similarity index 100% rename from docs_src/tutorial/code_structure/tutorial001_py310/models.py rename to docs_src/tutorial/code_structure/tutorial001/models.py diff --git a/docs_src/tutorial/code_structure/tutorial002_py310/__init__.py b/docs_src/tutorial/code_structure/tutorial002/__init__.py similarity index 100% rename from docs_src/tutorial/code_structure/tutorial002_py310/__init__.py rename to docs_src/tutorial/code_structure/tutorial002/__init__.py diff --git a/docs_src/tutorial/code_structure/tutorial002_py310/app.py b/docs_src/tutorial/code_structure/tutorial002/app.py similarity index 100% rename from docs_src/tutorial/code_structure/tutorial002_py310/app.py rename to docs_src/tutorial/code_structure/tutorial002/app.py diff --git a/docs_src/tutorial/code_structure/tutorial002_py310/database.py b/docs_src/tutorial/code_structure/tutorial002/database.py similarity index 100% rename from docs_src/tutorial/code_structure/tutorial002_py310/database.py rename to docs_src/tutorial/code_structure/tutorial002/database.py diff --git a/docs_src/tutorial/code_structure/tutorial002_py310/hero_model.py b/docs_src/tutorial/code_structure/tutorial002/hero_model.py similarity index 100% rename from docs_src/tutorial/code_structure/tutorial002_py310/hero_model.py rename to docs_src/tutorial/code_structure/tutorial002/hero_model.py diff --git a/docs_src/tutorial/code_structure/tutorial002_py310/team_model.py b/docs_src/tutorial/code_structure/tutorial002/team_model.py similarity index 100% rename from docs_src/tutorial/code_structure/tutorial002_py310/team_model.py rename to docs_src/tutorial/code_structure/tutorial002/team_model.py diff --git a/docs_src/tutorial/connect/create_tables/tutorial001_py310.py b/docs_src/tutorial/connect/create_tables/tutorial001.py similarity index 100% rename from docs_src/tutorial/connect/create_tables/tutorial001_py310.py rename to docs_src/tutorial/connect/create_tables/tutorial001.py diff --git a/docs_src/tutorial/connect/delete/tutorial001_py310.py b/docs_src/tutorial/connect/delete/tutorial001.py similarity index 100% rename from docs_src/tutorial/connect/delete/tutorial001_py310.py rename to docs_src/tutorial/connect/delete/tutorial001.py diff --git a/docs_src/tutorial/connect/insert/tutorial001_py310.py b/docs_src/tutorial/connect/insert/tutorial001.py similarity index 100% rename from docs_src/tutorial/connect/insert/tutorial001_py310.py rename to docs_src/tutorial/connect/insert/tutorial001.py diff --git a/docs_src/tutorial/connect/select/tutorial001_py310.py b/docs_src/tutorial/connect/select/tutorial001.py similarity index 100% rename from docs_src/tutorial/connect/select/tutorial001_py310.py rename to docs_src/tutorial/connect/select/tutorial001.py diff --git a/docs_src/tutorial/connect/select/tutorial002_py310.py b/docs_src/tutorial/connect/select/tutorial002.py similarity index 100% rename from docs_src/tutorial/connect/select/tutorial002_py310.py rename to docs_src/tutorial/connect/select/tutorial002.py diff --git a/docs_src/tutorial/connect/select/tutorial003_py310.py b/docs_src/tutorial/connect/select/tutorial003.py similarity index 100% rename from docs_src/tutorial/connect/select/tutorial003_py310.py rename to docs_src/tutorial/connect/select/tutorial003.py diff --git a/docs_src/tutorial/connect/select/tutorial004_py310.py b/docs_src/tutorial/connect/select/tutorial004.py similarity index 100% rename from docs_src/tutorial/connect/select/tutorial004_py310.py rename to docs_src/tutorial/connect/select/tutorial004.py diff --git a/docs_src/tutorial/connect/select/tutorial005_py310.py b/docs_src/tutorial/connect/select/tutorial005.py similarity index 100% rename from docs_src/tutorial/connect/select/tutorial005_py310.py rename to docs_src/tutorial/connect/select/tutorial005.py diff --git a/docs_src/tutorial/connect/update/tutorial001_py310.py b/docs_src/tutorial/connect/update/tutorial001.py similarity index 100% rename from docs_src/tutorial/connect/update/tutorial001_py310.py rename to docs_src/tutorial/connect/update/tutorial001.py diff --git a/docs_src/tutorial/create_db_and_table/tutorial001_py310.py b/docs_src/tutorial/create_db_and_table/tutorial001.py similarity index 100% rename from docs_src/tutorial/create_db_and_table/tutorial001_py310.py rename to docs_src/tutorial/create_db_and_table/tutorial001.py diff --git a/docs_src/tutorial/create_db_and_table/tutorial002_py310.py b/docs_src/tutorial/create_db_and_table/tutorial002.py similarity index 100% rename from docs_src/tutorial/create_db_and_table/tutorial002_py310.py rename to docs_src/tutorial/create_db_and_table/tutorial002.py diff --git a/docs_src/tutorial/create_db_and_table/tutorial003_py310.py b/docs_src/tutorial/create_db_and_table/tutorial003.py similarity index 100% rename from docs_src/tutorial/create_db_and_table/tutorial003_py310.py rename to docs_src/tutorial/create_db_and_table/tutorial003.py diff --git a/docs_src/tutorial/delete/tutorial001_py310.py b/docs_src/tutorial/delete/tutorial001.py similarity index 100% rename from docs_src/tutorial/delete/tutorial001_py310.py rename to docs_src/tutorial/delete/tutorial001.py diff --git a/docs_src/tutorial/delete/tutorial002_py310.py b/docs_src/tutorial/delete/tutorial002.py similarity index 100% rename from docs_src/tutorial/delete/tutorial002_py310.py rename to docs_src/tutorial/delete/tutorial002.py diff --git a/docs_src/tutorial/fastapi/app_testing/tutorial001_py310/__init__.py b/docs_src/tutorial/fastapi/app_testing/tutorial001/__init__.py similarity index 100% rename from docs_src/tutorial/fastapi/app_testing/tutorial001_py310/__init__.py rename to docs_src/tutorial/fastapi/app_testing/tutorial001/__init__.py diff --git a/docs_src/tutorial/fastapi/app_testing/tutorial001_py310/annotations/en/test_main_001.md b/docs_src/tutorial/fastapi/app_testing/tutorial001/annotations/en/test_main_001.md similarity index 100% rename from docs_src/tutorial/fastapi/app_testing/tutorial001_py310/annotations/en/test_main_001.md rename to docs_src/tutorial/fastapi/app_testing/tutorial001/annotations/en/test_main_001.md diff --git a/docs_src/tutorial/fastapi/app_testing/tutorial001_py310/annotations/en/test_main_002.md b/docs_src/tutorial/fastapi/app_testing/tutorial001/annotations/en/test_main_002.md similarity index 100% rename from docs_src/tutorial/fastapi/app_testing/tutorial001_py310/annotations/en/test_main_002.md rename to docs_src/tutorial/fastapi/app_testing/tutorial001/annotations/en/test_main_002.md diff --git a/docs_src/tutorial/fastapi/app_testing/tutorial001_py310/annotations/en/test_main_003.md b/docs_src/tutorial/fastapi/app_testing/tutorial001/annotations/en/test_main_003.md similarity index 100% rename from docs_src/tutorial/fastapi/app_testing/tutorial001_py310/annotations/en/test_main_003.md rename to docs_src/tutorial/fastapi/app_testing/tutorial001/annotations/en/test_main_003.md diff --git a/docs_src/tutorial/fastapi/app_testing/tutorial001_py310/annotations/en/test_main_004.md b/docs_src/tutorial/fastapi/app_testing/tutorial001/annotations/en/test_main_004.md similarity index 100% rename from docs_src/tutorial/fastapi/app_testing/tutorial001_py310/annotations/en/test_main_004.md rename to docs_src/tutorial/fastapi/app_testing/tutorial001/annotations/en/test_main_004.md diff --git a/docs_src/tutorial/fastapi/app_testing/tutorial001_py310/annotations/en/test_main_005.md b/docs_src/tutorial/fastapi/app_testing/tutorial001/annotations/en/test_main_005.md similarity index 100% rename from docs_src/tutorial/fastapi/app_testing/tutorial001_py310/annotations/en/test_main_005.md rename to docs_src/tutorial/fastapi/app_testing/tutorial001/annotations/en/test_main_005.md diff --git a/docs_src/tutorial/fastapi/app_testing/tutorial001_py310/annotations/en/test_main_006.md b/docs_src/tutorial/fastapi/app_testing/tutorial001/annotations/en/test_main_006.md similarity index 100% rename from docs_src/tutorial/fastapi/app_testing/tutorial001_py310/annotations/en/test_main_006.md rename to docs_src/tutorial/fastapi/app_testing/tutorial001/annotations/en/test_main_006.md diff --git a/docs_src/tutorial/fastapi/app_testing/tutorial001_py310/main.py b/docs_src/tutorial/fastapi/app_testing/tutorial001/main.py similarity index 100% rename from docs_src/tutorial/fastapi/app_testing/tutorial001_py310/main.py rename to docs_src/tutorial/fastapi/app_testing/tutorial001/main.py diff --git a/docs_src/tutorial/fastapi/app_testing/tutorial001_py310/test_extra_coverage.py b/docs_src/tutorial/fastapi/app_testing/tutorial001/test_extra_coverage.py similarity index 100% rename from docs_src/tutorial/fastapi/app_testing/tutorial001_py310/test_extra_coverage.py rename to docs_src/tutorial/fastapi/app_testing/tutorial001/test_extra_coverage.py diff --git a/docs_src/tutorial/fastapi/app_testing/tutorial001_py310/test_main.py b/docs_src/tutorial/fastapi/app_testing/tutorial001/test_main.py similarity index 100% rename from docs_src/tutorial/fastapi/app_testing/tutorial001_py310/test_main.py rename to docs_src/tutorial/fastapi/app_testing/tutorial001/test_main.py diff --git a/docs_src/tutorial/fastapi/app_testing/tutorial001_py310/test_main_001.py b/docs_src/tutorial/fastapi/app_testing/tutorial001/test_main_001.py similarity index 100% rename from docs_src/tutorial/fastapi/app_testing/tutorial001_py310/test_main_001.py rename to docs_src/tutorial/fastapi/app_testing/tutorial001/test_main_001.py diff --git a/docs_src/tutorial/fastapi/app_testing/tutorial001_py310/test_main_002.py b/docs_src/tutorial/fastapi/app_testing/tutorial001/test_main_002.py similarity index 100% rename from docs_src/tutorial/fastapi/app_testing/tutorial001_py310/test_main_002.py rename to docs_src/tutorial/fastapi/app_testing/tutorial001/test_main_002.py diff --git a/docs_src/tutorial/fastapi/app_testing/tutorial001_py310/test_main_003.py b/docs_src/tutorial/fastapi/app_testing/tutorial001/test_main_003.py similarity index 100% rename from docs_src/tutorial/fastapi/app_testing/tutorial001_py310/test_main_003.py rename to docs_src/tutorial/fastapi/app_testing/tutorial001/test_main_003.py diff --git a/docs_src/tutorial/fastapi/app_testing/tutorial001_py310/test_main_004.py b/docs_src/tutorial/fastapi/app_testing/tutorial001/test_main_004.py similarity index 100% rename from docs_src/tutorial/fastapi/app_testing/tutorial001_py310/test_main_004.py rename to docs_src/tutorial/fastapi/app_testing/tutorial001/test_main_004.py diff --git a/docs_src/tutorial/fastapi/app_testing/tutorial001_py310/test_main_005.py b/docs_src/tutorial/fastapi/app_testing/tutorial001/test_main_005.py similarity index 100% rename from docs_src/tutorial/fastapi/app_testing/tutorial001_py310/test_main_005.py rename to docs_src/tutorial/fastapi/app_testing/tutorial001/test_main_005.py diff --git a/docs_src/tutorial/fastapi/app_testing/tutorial001_py310/test_main_006.py b/docs_src/tutorial/fastapi/app_testing/tutorial001/test_main_006.py similarity index 100% rename from docs_src/tutorial/fastapi/app_testing/tutorial001_py310/test_main_006.py rename to docs_src/tutorial/fastapi/app_testing/tutorial001/test_main_006.py diff --git a/docs_src/tutorial/fastapi/delete/tutorial001_py310.py b/docs_src/tutorial/fastapi/delete/tutorial001.py similarity index 100% rename from docs_src/tutorial/fastapi/delete/tutorial001_py310.py rename to docs_src/tutorial/fastapi/delete/tutorial001.py diff --git a/docs_src/tutorial/fastapi/limit_and_offset/tutorial001_py310.py b/docs_src/tutorial/fastapi/limit_and_offset/tutorial001.py similarity index 100% rename from docs_src/tutorial/fastapi/limit_and_offset/tutorial001_py310.py rename to docs_src/tutorial/fastapi/limit_and_offset/tutorial001.py diff --git a/docs_src/tutorial/fastapi/multiple_models/tutorial001_py310.py b/docs_src/tutorial/fastapi/multiple_models/tutorial001.py similarity index 100% rename from docs_src/tutorial/fastapi/multiple_models/tutorial001_py310.py rename to docs_src/tutorial/fastapi/multiple_models/tutorial001.py diff --git a/docs_src/tutorial/fastapi/multiple_models/tutorial002_py310.py b/docs_src/tutorial/fastapi/multiple_models/tutorial002.py similarity index 100% rename from docs_src/tutorial/fastapi/multiple_models/tutorial002_py310.py rename to docs_src/tutorial/fastapi/multiple_models/tutorial002.py diff --git a/docs_src/tutorial/fastapi/read_one/tutorial001_py310.py b/docs_src/tutorial/fastapi/read_one/tutorial001.py similarity index 100% rename from docs_src/tutorial/fastapi/read_one/tutorial001_py310.py rename to docs_src/tutorial/fastapi/read_one/tutorial001.py diff --git a/docs_src/tutorial/fastapi/relationships/tutorial001_py310.py b/docs_src/tutorial/fastapi/relationships/tutorial001.py similarity index 100% rename from docs_src/tutorial/fastapi/relationships/tutorial001_py310.py rename to docs_src/tutorial/fastapi/relationships/tutorial001.py diff --git a/docs_src/tutorial/fastapi/response_model/tutorial001_py310.py b/docs_src/tutorial/fastapi/response_model/tutorial001.py similarity index 100% rename from docs_src/tutorial/fastapi/response_model/tutorial001_py310.py rename to docs_src/tutorial/fastapi/response_model/tutorial001.py diff --git a/docs_src/tutorial/fastapi/session_with_dependency/tutorial001_py310.py b/docs_src/tutorial/fastapi/session_with_dependency/tutorial001.py similarity index 100% rename from docs_src/tutorial/fastapi/session_with_dependency/tutorial001_py310.py rename to docs_src/tutorial/fastapi/session_with_dependency/tutorial001.py diff --git a/docs_src/tutorial/fastapi/simple_hero_api/tutorial001_py310.py b/docs_src/tutorial/fastapi/simple_hero_api/tutorial001.py similarity index 100% rename from docs_src/tutorial/fastapi/simple_hero_api/tutorial001_py310.py rename to docs_src/tutorial/fastapi/simple_hero_api/tutorial001.py diff --git a/docs_src/tutorial/fastapi/teams/tutorial001_py310.py b/docs_src/tutorial/fastapi/teams/tutorial001.py similarity index 100% rename from docs_src/tutorial/fastapi/teams/tutorial001_py310.py rename to docs_src/tutorial/fastapi/teams/tutorial001.py diff --git a/docs_src/tutorial/fastapi/update/tutorial001_py310.py b/docs_src/tutorial/fastapi/update/tutorial001.py similarity index 100% rename from docs_src/tutorial/fastapi/update/tutorial001_py310.py rename to docs_src/tutorial/fastapi/update/tutorial001.py diff --git a/docs_src/tutorial/fastapi/update/tutorial002_py310.py b/docs_src/tutorial/fastapi/update/tutorial002.py similarity index 100% rename from docs_src/tutorial/fastapi/update/tutorial002_py310.py rename to docs_src/tutorial/fastapi/update/tutorial002.py diff --git a/docs_src/tutorial/indexes/tutorial001_py310.py b/docs_src/tutorial/indexes/tutorial001.py similarity index 100% rename from docs_src/tutorial/indexes/tutorial001_py310.py rename to docs_src/tutorial/indexes/tutorial001.py diff --git a/docs_src/tutorial/indexes/tutorial002_py310.py b/docs_src/tutorial/indexes/tutorial002.py similarity index 100% rename from docs_src/tutorial/indexes/tutorial002_py310.py rename to docs_src/tutorial/indexes/tutorial002.py diff --git a/docs_src/tutorial/insert/tutorial001_py310.py b/docs_src/tutorial/insert/tutorial001.py similarity index 100% rename from docs_src/tutorial/insert/tutorial001_py310.py rename to docs_src/tutorial/insert/tutorial001.py diff --git a/docs_src/tutorial/insert/tutorial002_py310.py b/docs_src/tutorial/insert/tutorial002.py similarity index 100% rename from docs_src/tutorial/insert/tutorial002_py310.py rename to docs_src/tutorial/insert/tutorial002.py diff --git a/docs_src/tutorial/insert/tutorial003_py310.py b/docs_src/tutorial/insert/tutorial003.py similarity index 100% rename from docs_src/tutorial/insert/tutorial003_py310.py rename to docs_src/tutorial/insert/tutorial003.py diff --git a/docs_src/tutorial/many_to_many/tutorial001_py310.py b/docs_src/tutorial/many_to_many/tutorial001.py similarity index 100% rename from docs_src/tutorial/many_to_many/tutorial001_py310.py rename to docs_src/tutorial/many_to_many/tutorial001.py diff --git a/docs_src/tutorial/many_to_many/tutorial002_py310.py b/docs_src/tutorial/many_to_many/tutorial002.py similarity index 100% rename from docs_src/tutorial/many_to_many/tutorial002_py310.py rename to docs_src/tutorial/many_to_many/tutorial002.py diff --git a/docs_src/tutorial/many_to_many/tutorial003_py310.py b/docs_src/tutorial/many_to_many/tutorial003.py similarity index 100% rename from docs_src/tutorial/many_to_many/tutorial003_py310.py rename to docs_src/tutorial/many_to_many/tutorial003.py diff --git a/docs_src/tutorial/offset_and_limit/tutorial001_py310.py b/docs_src/tutorial/offset_and_limit/tutorial001.py similarity index 100% rename from docs_src/tutorial/offset_and_limit/tutorial001_py310.py rename to docs_src/tutorial/offset_and_limit/tutorial001.py diff --git a/docs_src/tutorial/offset_and_limit/tutorial002_py310.py b/docs_src/tutorial/offset_and_limit/tutorial002.py similarity index 100% rename from docs_src/tutorial/offset_and_limit/tutorial002_py310.py rename to docs_src/tutorial/offset_and_limit/tutorial002.py diff --git a/docs_src/tutorial/offset_and_limit/tutorial003_py310.py b/docs_src/tutorial/offset_and_limit/tutorial003.py similarity index 100% rename from docs_src/tutorial/offset_and_limit/tutorial003_py310.py rename to docs_src/tutorial/offset_and_limit/tutorial003.py diff --git a/docs_src/tutorial/offset_and_limit/tutorial004_py310.py b/docs_src/tutorial/offset_and_limit/tutorial004.py similarity index 100% rename from docs_src/tutorial/offset_and_limit/tutorial004_py310.py rename to docs_src/tutorial/offset_and_limit/tutorial004.py diff --git a/docs_src/tutorial/one/tutorial001_py310.py b/docs_src/tutorial/one/tutorial001.py similarity index 100% rename from docs_src/tutorial/one/tutorial001_py310.py rename to docs_src/tutorial/one/tutorial001.py diff --git a/docs_src/tutorial/one/tutorial002_py310.py b/docs_src/tutorial/one/tutorial002.py similarity index 100% rename from docs_src/tutorial/one/tutorial002_py310.py rename to docs_src/tutorial/one/tutorial002.py diff --git a/docs_src/tutorial/one/tutorial003_py310.py b/docs_src/tutorial/one/tutorial003.py similarity index 100% rename from docs_src/tutorial/one/tutorial003_py310.py rename to docs_src/tutorial/one/tutorial003.py diff --git a/docs_src/tutorial/one/tutorial004_py310.py b/docs_src/tutorial/one/tutorial004.py similarity index 100% rename from docs_src/tutorial/one/tutorial004_py310.py rename to docs_src/tutorial/one/tutorial004.py diff --git a/docs_src/tutorial/one/tutorial005_py310.py b/docs_src/tutorial/one/tutorial005.py similarity index 100% rename from docs_src/tutorial/one/tutorial005_py310.py rename to docs_src/tutorial/one/tutorial005.py diff --git a/docs_src/tutorial/one/tutorial006_py310.py b/docs_src/tutorial/one/tutorial006.py similarity index 100% rename from docs_src/tutorial/one/tutorial006_py310.py rename to docs_src/tutorial/one/tutorial006.py diff --git a/docs_src/tutorial/one/tutorial007_py310.py b/docs_src/tutorial/one/tutorial007.py similarity index 100% rename from docs_src/tutorial/one/tutorial007_py310.py rename to docs_src/tutorial/one/tutorial007.py diff --git a/docs_src/tutorial/one/tutorial008_py310.py b/docs_src/tutorial/one/tutorial008.py similarity index 100% rename from docs_src/tutorial/one/tutorial008_py310.py rename to docs_src/tutorial/one/tutorial008.py diff --git a/docs_src/tutorial/one/tutorial009_py310.py b/docs_src/tutorial/one/tutorial009.py similarity index 100% rename from docs_src/tutorial/one/tutorial009_py310.py rename to docs_src/tutorial/one/tutorial009.py diff --git a/docs_src/tutorial/relationship_attributes/back_populates/tutorial001_py310.py b/docs_src/tutorial/relationship_attributes/back_populates/tutorial001.py similarity index 100% rename from docs_src/tutorial/relationship_attributes/back_populates/tutorial001_py310.py rename to docs_src/tutorial/relationship_attributes/back_populates/tutorial001.py diff --git a/docs_src/tutorial/relationship_attributes/back_populates/tutorial002_py310.py b/docs_src/tutorial/relationship_attributes/back_populates/tutorial002.py similarity index 100% rename from docs_src/tutorial/relationship_attributes/back_populates/tutorial002_py310.py rename to docs_src/tutorial/relationship_attributes/back_populates/tutorial002.py diff --git a/docs_src/tutorial/relationship_attributes/back_populates/tutorial003_py310.py b/docs_src/tutorial/relationship_attributes/back_populates/tutorial003.py similarity index 100% rename from docs_src/tutorial/relationship_attributes/back_populates/tutorial003_py310.py rename to docs_src/tutorial/relationship_attributes/back_populates/tutorial003.py diff --git a/docs_src/tutorial/relationship_attributes/cascade_delete_relationships/tutorial001_py310.py b/docs_src/tutorial/relationship_attributes/cascade_delete_relationships/tutorial001.py similarity index 100% rename from docs_src/tutorial/relationship_attributes/cascade_delete_relationships/tutorial001_py310.py rename to docs_src/tutorial/relationship_attributes/cascade_delete_relationships/tutorial001.py diff --git a/docs_src/tutorial/relationship_attributes/cascade_delete_relationships/tutorial002_py310.py b/docs_src/tutorial/relationship_attributes/cascade_delete_relationships/tutorial002.py similarity index 100% rename from docs_src/tutorial/relationship_attributes/cascade_delete_relationships/tutorial002_py310.py rename to docs_src/tutorial/relationship_attributes/cascade_delete_relationships/tutorial002.py diff --git a/docs_src/tutorial/relationship_attributes/cascade_delete_relationships/tutorial003_py310.py b/docs_src/tutorial/relationship_attributes/cascade_delete_relationships/tutorial003.py similarity index 100% rename from docs_src/tutorial/relationship_attributes/cascade_delete_relationships/tutorial003_py310.py rename to docs_src/tutorial/relationship_attributes/cascade_delete_relationships/tutorial003.py diff --git a/docs_src/tutorial/relationship_attributes/cascade_delete_relationships/tutorial004_py310.py b/docs_src/tutorial/relationship_attributes/cascade_delete_relationships/tutorial004.py similarity index 100% rename from docs_src/tutorial/relationship_attributes/cascade_delete_relationships/tutorial004_py310.py rename to docs_src/tutorial/relationship_attributes/cascade_delete_relationships/tutorial004.py diff --git a/docs_src/tutorial/relationship_attributes/cascade_delete_relationships/tutorial005_py310.py b/docs_src/tutorial/relationship_attributes/cascade_delete_relationships/tutorial005.py similarity index 100% rename from docs_src/tutorial/relationship_attributes/cascade_delete_relationships/tutorial005_py310.py rename to docs_src/tutorial/relationship_attributes/cascade_delete_relationships/tutorial005.py diff --git a/docs_src/tutorial/relationship_attributes/create_and_update_relationships/tutorial001_py310.py b/docs_src/tutorial/relationship_attributes/create_and_update_relationships/tutorial001.py similarity index 100% rename from docs_src/tutorial/relationship_attributes/create_and_update_relationships/tutorial001_py310.py rename to docs_src/tutorial/relationship_attributes/create_and_update_relationships/tutorial001.py diff --git a/docs_src/tutorial/relationship_attributes/define_relationship_attributes/tutorial001_py310.py b/docs_src/tutorial/relationship_attributes/define_relationship_attributes/tutorial001.py similarity index 100% rename from docs_src/tutorial/relationship_attributes/define_relationship_attributes/tutorial001_py310.py rename to docs_src/tutorial/relationship_attributes/define_relationship_attributes/tutorial001.py diff --git a/docs_src/tutorial/relationship_attributes/read_relationships/tutorial001_py310.py b/docs_src/tutorial/relationship_attributes/read_relationships/tutorial001.py similarity index 100% rename from docs_src/tutorial/relationship_attributes/read_relationships/tutorial001_py310.py rename to docs_src/tutorial/relationship_attributes/read_relationships/tutorial001.py diff --git a/docs_src/tutorial/relationship_attributes/read_relationships/tutorial002_py310.py b/docs_src/tutorial/relationship_attributes/read_relationships/tutorial002.py similarity index 100% rename from docs_src/tutorial/relationship_attributes/read_relationships/tutorial002_py310.py rename to docs_src/tutorial/relationship_attributes/read_relationships/tutorial002.py diff --git a/docs_src/tutorial/select/tutorial001_py310.py b/docs_src/tutorial/select/tutorial001.py similarity index 100% rename from docs_src/tutorial/select/tutorial001_py310.py rename to docs_src/tutorial/select/tutorial001.py diff --git a/docs_src/tutorial/select/tutorial002_py310.py b/docs_src/tutorial/select/tutorial002.py similarity index 100% rename from docs_src/tutorial/select/tutorial002_py310.py rename to docs_src/tutorial/select/tutorial002.py diff --git a/docs_src/tutorial/select/tutorial003_py310.py b/docs_src/tutorial/select/tutorial003.py similarity index 100% rename from docs_src/tutorial/select/tutorial003_py310.py rename to docs_src/tutorial/select/tutorial003.py diff --git a/docs_src/tutorial/select/tutorial004_py310.py b/docs_src/tutorial/select/tutorial004.py similarity index 100% rename from docs_src/tutorial/select/tutorial004_py310.py rename to docs_src/tutorial/select/tutorial004.py diff --git a/docs_src/tutorial/update/tutorial001_py310.py b/docs_src/tutorial/update/tutorial001.py similarity index 100% rename from docs_src/tutorial/update/tutorial001_py310.py rename to docs_src/tutorial/update/tutorial001.py diff --git a/docs_src/tutorial/update/tutorial002_py310.py b/docs_src/tutorial/update/tutorial002.py similarity index 100% rename from docs_src/tutorial/update/tutorial002_py310.py rename to docs_src/tutorial/update/tutorial002.py diff --git a/docs_src/tutorial/update/tutorial003_py310.py b/docs_src/tutorial/update/tutorial003.py similarity index 100% rename from docs_src/tutorial/update/tutorial003_py310.py rename to docs_src/tutorial/update/tutorial003.py diff --git a/docs_src/tutorial/update/tutorial004_py310.py b/docs_src/tutorial/update/tutorial004.py similarity index 100% rename from docs_src/tutorial/update/tutorial004_py310.py rename to docs_src/tutorial/update/tutorial004.py diff --git a/docs_src/tutorial/where/tutorial001_py310.py b/docs_src/tutorial/where/tutorial001.py similarity index 100% rename from docs_src/tutorial/where/tutorial001_py310.py rename to docs_src/tutorial/where/tutorial001.py diff --git a/docs_src/tutorial/where/tutorial002_py310.py b/docs_src/tutorial/where/tutorial002.py similarity index 100% rename from docs_src/tutorial/where/tutorial002_py310.py rename to docs_src/tutorial/where/tutorial002.py diff --git a/docs_src/tutorial/where/tutorial003_py310.py b/docs_src/tutorial/where/tutorial003.py similarity index 100% rename from docs_src/tutorial/where/tutorial003_py310.py rename to docs_src/tutorial/where/tutorial003.py diff --git a/docs_src/tutorial/where/tutorial004_py310.py b/docs_src/tutorial/where/tutorial004.py similarity index 100% rename from docs_src/tutorial/where/tutorial004_py310.py rename to docs_src/tutorial/where/tutorial004.py diff --git a/docs_src/tutorial/where/tutorial005_py310.py b/docs_src/tutorial/where/tutorial005.py similarity index 100% rename from docs_src/tutorial/where/tutorial005_py310.py rename to docs_src/tutorial/where/tutorial005.py diff --git a/docs_src/tutorial/where/tutorial006_py310.py b/docs_src/tutorial/where/tutorial006.py similarity index 100% rename from docs_src/tutorial/where/tutorial006_py310.py rename to docs_src/tutorial/where/tutorial006.py diff --git a/docs_src/tutorial/where/tutorial006b_py310.py b/docs_src/tutorial/where/tutorial006b.py similarity index 100% rename from docs_src/tutorial/where/tutorial006b_py310.py rename to docs_src/tutorial/where/tutorial006b.py diff --git a/docs_src/tutorial/where/tutorial007_py310.py b/docs_src/tutorial/where/tutorial007.py similarity index 100% rename from docs_src/tutorial/where/tutorial007_py310.py rename to docs_src/tutorial/where/tutorial007.py diff --git a/docs_src/tutorial/where/tutorial008_py310.py b/docs_src/tutorial/where/tutorial008.py similarity index 100% rename from docs_src/tutorial/where/tutorial008_py310.py rename to docs_src/tutorial/where/tutorial008.py diff --git a/docs_src/tutorial/where/tutorial009_py310.py b/docs_src/tutorial/where/tutorial009.py similarity index 100% rename from docs_src/tutorial/where/tutorial009_py310.py rename to docs_src/tutorial/where/tutorial009.py diff --git a/docs_src/tutorial/where/tutorial011_py310.py b/docs_src/tutorial/where/tutorial011.py similarity index 100% rename from docs_src/tutorial/where/tutorial011_py310.py rename to docs_src/tutorial/where/tutorial011.py diff --git a/tests/test_advanced/test_datetime/test_tutorial002.py b/tests/test_advanced/test_datetime/test_tutorial002.py index 85111a8bfa..2d4d91f473 100644 --- a/tests/test_advanced/test_datetime/test_tutorial002.py +++ b/tests/test_advanced/test_datetime/test_tutorial002.py @@ -12,7 +12,7 @@ @pytest.fixture( name="mod", params=[ - pytest.param("tutorial002_py310"), + pytest.param("tutorial002"), ], ) def get_module(request: pytest.FixtureRequest) -> ModuleType: diff --git a/tests/test_advanced/test_datetime/test_tutorial003.py b/tests/test_advanced/test_datetime/test_tutorial003.py index f205226fc2..45b2885e76 100644 --- a/tests/test_advanced/test_datetime/test_tutorial003.py +++ b/tests/test_advanced/test_datetime/test_tutorial003.py @@ -11,7 +11,7 @@ @pytest.fixture( name="mod", params=[ - pytest.param("tutorial003_py310"), + pytest.param("tutorial003"), ], ) def get_module(request: pytest.FixtureRequest) -> ModuleType: diff --git a/tests/test_advanced/test_datetime/test_tutorial004.py b/tests/test_advanced/test_datetime/test_tutorial004.py index 64fb4beaed..4076cd7369 100644 --- a/tests/test_advanced/test_datetime/test_tutorial004.py +++ b/tests/test_advanced/test_datetime/test_tutorial004.py @@ -10,7 +10,7 @@ @pytest.fixture( name="mod", params=[ - pytest.param("tutorial004_py310"), + pytest.param("tutorial004"), ], ) def get_module(request: pytest.FixtureRequest) -> ModuleType: diff --git a/tests/test_advanced/test_datetime/test_tutorial005.py b/tests/test_advanced/test_datetime/test_tutorial005.py index 06b2a80e4e..a98e0d86c6 100644 --- a/tests/test_advanced/test_datetime/test_tutorial005.py +++ b/tests/test_advanced/test_datetime/test_tutorial005.py @@ -12,7 +12,7 @@ @pytest.fixture( name="mod", params=[ - pytest.param("tutorial005_py310"), + pytest.param("tutorial005"), ], ) def get_module(request: pytest.FixtureRequest) -> ModuleType: diff --git a/tests/test_advanced/test_decimal/test_tutorial001.py b/tests/test_advanced/test_decimal/test_tutorial001.py index 1e91f318f4..1e32e787cf 100644 --- a/tests/test_advanced/test_decimal/test_tutorial001.py +++ b/tests/test_advanced/test_decimal/test_tutorial001.py @@ -11,7 +11,7 @@ @pytest.fixture( name="mod", params=[ - pytest.param("tutorial001_py310"), + pytest.param("tutorial001"), ], ) def get_module(request: pytest.FixtureRequest, database_engine: Engine) -> ModuleType: diff --git a/tests/test_advanced/test_uuid/test_tutorial001.py b/tests/test_advanced/test_uuid/test_tutorial001.py index 426304f456..2aea01caa6 100644 --- a/tests/test_advanced/test_uuid/test_tutorial001.py +++ b/tests/test_advanced/test_uuid/test_tutorial001.py @@ -11,7 +11,7 @@ @pytest.fixture( name="mod", params=[ - pytest.param("tutorial001_py310"), + pytest.param("tutorial001"), ], ) def get_module(request: pytest.FixtureRequest, database_engine: Engine) -> ModuleType: diff --git a/tests/test_advanced/test_uuid/test_tutorial002.py b/tests/test_advanced/test_uuid/test_tutorial002.py index 10e5df55bb..98370c9bbe 100644 --- a/tests/test_advanced/test_uuid/test_tutorial002.py +++ b/tests/test_advanced/test_uuid/test_tutorial002.py @@ -11,7 +11,7 @@ @pytest.fixture( name="mod", params=[ - pytest.param("tutorial002_py310"), + pytest.param("tutorial002"), ], ) def get_module(request: pytest.FixtureRequest, database_engine: Engine) -> ModuleType: diff --git a/tests/test_tutorial/test_automatic_id_none_refresh/test_tutorial001_tutorial002.py b/tests/test_tutorial/test_automatic_id_none_refresh/test_tutorial001_tutorial002.py index c72af8bd66..2941b5b2d7 100644 --- a/tests/test_tutorial/test_automatic_id_none_refresh/test_tutorial001_tutorial002.py +++ b/tests/test_tutorial/test_automatic_id_none_refresh/test_tutorial001_tutorial002.py @@ -138,8 +138,8 @@ def check_calls(calls: list[list[str | dict[str, Any]]]) -> None: @pytest.fixture( name="module", params=[ - pytest.param("tutorial001_py310"), - pytest.param("tutorial002_py310"), + pytest.param("tutorial001"), + pytest.param("tutorial002"), ], ) def get_module(request: pytest.FixtureRequest, database_engine: Engine) -> ModuleType: diff --git a/tests/test_tutorial/test_code_structure/test_tutorial001.py b/tests/test_tutorial/test_code_structure/test_tutorial001.py index e040147def..2ff4f1118f 100644 --- a/tests/test_tutorial/test_code_structure/test_tutorial001.py +++ b/tests/test_tutorial/test_code_structure/test_tutorial001.py @@ -34,7 +34,7 @@ class Modules: @pytest.fixture( name="modules", params=[ - pytest.param("tutorial001_py310"), + pytest.param("tutorial001"), ], ) def get_modules(request: pytest.FixtureRequest, database_engine: Engine) -> Modules: diff --git a/tests/test_tutorial/test_code_structure/test_tutorial002.py b/tests/test_tutorial/test_code_structure/test_tutorial002.py index 31c9a8ab5f..df3981abc0 100644 --- a/tests/test_tutorial/test_code_structure/test_tutorial002.py +++ b/tests/test_tutorial/test_code_structure/test_tutorial002.py @@ -34,7 +34,7 @@ class Modules: @pytest.fixture( name="modules", params=[ - pytest.param("tutorial002_py310"), + pytest.param("tutorial002"), ], ) def get_modules(request: pytest.FixtureRequest, database_engine: Engine) -> Modules: diff --git a/tests/test_tutorial/test_connect/test_create_connected_tables/test_tutorial001.py b/tests/test_tutorial/test_connect/test_create_connected_tables/test_tutorial001.py index 1360dc7d56..ed36ecda2c 100644 --- a/tests/test_tutorial/test_connect/test_create_connected_tables/test_tutorial001.py +++ b/tests/test_tutorial/test_connect/test_create_connected_tables/test_tutorial001.py @@ -9,7 +9,7 @@ @pytest.fixture( name="module", params=[ - pytest.param("tutorial001_py310"), + pytest.param("tutorial001"), ], ) def get_module(request: pytest.FixtureRequest, database_engine: Engine) -> ModuleType: diff --git a/tests/test_tutorial/test_connect/test_delete/test_tutorial001.py b/tests/test_tutorial/test_connect/test_delete/test_tutorial001.py index 76733a1daf..4125ff5d33 100644 --- a/tests/test_tutorial/test_connect/test_delete/test_tutorial001.py +++ b/tests/test_tutorial/test_connect/test_delete/test_tutorial001.py @@ -63,7 +63,7 @@ @pytest.fixture( name="module", params=[ - pytest.param("tutorial001_py310"), + pytest.param("tutorial001"), ], ) def get_module(request: pytest.FixtureRequest, database_engine: Engine) -> ModuleType: diff --git a/tests/test_tutorial/test_connect/test_insert/test_tutorial001.py b/tests/test_tutorial/test_connect/test_insert/test_tutorial001.py index bb23661461..4c1a24bcef 100644 --- a/tests/test_tutorial/test_connect/test_insert/test_tutorial001.py +++ b/tests/test_tutorial/test_connect/test_insert/test_tutorial001.py @@ -43,7 +43,7 @@ @pytest.fixture( name="module", params=[ - pytest.param("tutorial001_py310"), + pytest.param("tutorial001"), ], ) def get_module(request: pytest.FixtureRequest, database_engine: Engine) -> ModuleType: diff --git a/tests/test_tutorial/test_connect/test_select/test_tutorial001_tutorial002.py b/tests/test_tutorial/test_connect/test_select/test_tutorial001_tutorial002.py index 277382588b..3d60cde809 100644 --- a/tests/test_tutorial/test_connect/test_select/test_tutorial001_tutorial002.py +++ b/tests/test_tutorial/test_connect/test_select/test_tutorial001_tutorial002.py @@ -77,7 +77,7 @@ def get_module(request: pytest.FixtureRequest, database_engine: Engine) -> Modul @pytest.mark.parametrize( "module", [ - pytest.param("tutorial001_py310"), + pytest.param("tutorial001"), ], indirect=True, ) @@ -90,7 +90,7 @@ def test_tutorial001(print_mock: PrintMock, module: ModuleType): @pytest.mark.parametrize( "module", [ - pytest.param("tutorial002_py310"), + pytest.param("tutorial002"), ], indirect=True, ) diff --git a/tests/test_tutorial/test_connect/test_select/test_tutorial003.py b/tests/test_tutorial/test_connect/test_select/test_tutorial003.py index 5a6bf030cf..47982deeb4 100644 --- a/tests/test_tutorial/test_connect/test_select/test_tutorial003.py +++ b/tests/test_tutorial/test_connect/test_select/test_tutorial003.py @@ -79,7 +79,7 @@ @pytest.fixture( name="module", params=[ - pytest.param("tutorial003_py310"), + pytest.param("tutorial003"), ], ) def get_module(request: pytest.FixtureRequest, database_engine: Engine) -> ModuleType: diff --git a/tests/test_tutorial/test_connect/test_select/test_tutorial004.py b/tests/test_tutorial/test_connect/test_select/test_tutorial004.py index 107141ff24..bae06e82e7 100644 --- a/tests/test_tutorial/test_connect/test_select/test_tutorial004.py +++ b/tests/test_tutorial/test_connect/test_select/test_tutorial004.py @@ -53,7 +53,7 @@ @pytest.fixture( name="module", params=[ - pytest.param("tutorial004_py310"), + pytest.param("tutorial004"), ], ) def get_module(request: pytest.FixtureRequest, database_engine: Engine) -> ModuleType: diff --git a/tests/test_tutorial/test_connect/test_select/test_tutorial005.py b/tests/test_tutorial/test_connect/test_select/test_tutorial005.py index c370c75459..bc82c50a49 100644 --- a/tests/test_tutorial/test_connect/test_select/test_tutorial005.py +++ b/tests/test_tutorial/test_connect/test_select/test_tutorial005.py @@ -55,7 +55,7 @@ @pytest.fixture( name="module", params=[ - pytest.param("tutorial005_py310"), + pytest.param("tutorial005"), ], ) def get_module(request: pytest.FixtureRequest, database_engine: Engine) -> ModuleType: diff --git a/tests/test_tutorial/test_connect/test_update/test_tutorial001.py b/tests/test_tutorial/test_connect/test_update/test_tutorial001.py index cd1c2d39db..9da7b24c66 100644 --- a/tests/test_tutorial/test_connect/test_update/test_tutorial001.py +++ b/tests/test_tutorial/test_connect/test_update/test_tutorial001.py @@ -53,7 +53,7 @@ @pytest.fixture( name="module", params=[ - pytest.param("tutorial001_py310"), + pytest.param("tutorial001"), ], ) def get_module(request: pytest.FixtureRequest, database_engine: Engine) -> ModuleType: diff --git a/tests/test_tutorial/test_create_db_and_table/test_tutorial001.py b/tests/test_tutorial/test_create_db_and_table/test_tutorial001.py index 336ddc8f75..0954d35eda 100644 --- a/tests/test_tutorial/test_create_db_and_table/test_tutorial001.py +++ b/tests/test_tutorial/test_create_db_and_table/test_tutorial001.py @@ -8,7 +8,7 @@ @pytest.mark.parametrize( "module_name", [ - pytest.param("tutorial001_py310"), + pytest.param("tutorial001"), ], ) def test_create_db_and_table(cov_tmp_path: Path, module_name: str): diff --git a/tests/test_tutorial/test_create_db_and_table/test_tutorial002.py b/tests/test_tutorial/test_create_db_and_table/test_tutorial002.py index 1b7f8c9162..1a3415e367 100644 --- a/tests/test_tutorial/test_create_db_and_table/test_tutorial002.py +++ b/tests/test_tutorial/test_create_db_and_table/test_tutorial002.py @@ -9,7 +9,7 @@ @pytest.fixture( name="module", params=[ - pytest.param("tutorial002_py310"), + pytest.param("tutorial002"), ], ) def get_module(request: pytest.FixtureRequest, database_engine: Engine) -> ModuleType: diff --git a/tests/test_tutorial/test_create_db_and_table/test_tutorial003.py b/tests/test_tutorial/test_create_db_and_table/test_tutorial003.py index d8a936e8ac..0ffb2e9149 100644 --- a/tests/test_tutorial/test_create_db_and_table/test_tutorial003.py +++ b/tests/test_tutorial/test_create_db_and_table/test_tutorial003.py @@ -9,7 +9,7 @@ @pytest.fixture( name="module", params=[ - pytest.param("tutorial003_py310"), + pytest.param("tutorial003"), ], ) def get_module(request: pytest.FixtureRequest, database_engine: Engine) -> ModuleType: diff --git a/tests/test_tutorial/test_delete/test_tutorial001_tutorial002.py b/tests/test_tutorial/test_delete/test_tutorial001_tutorial002.py index 056c1fd98a..1655741e36 100644 --- a/tests/test_tutorial/test_delete/test_tutorial001_tutorial002.py +++ b/tests/test_tutorial/test_delete/test_tutorial001_tutorial002.py @@ -70,7 +70,7 @@ def get_module(request: pytest.FixtureRequest, database_engine: Engine) -> Modul @pytest.mark.parametrize( "module", [ - pytest.param("tutorial001_py310"), + pytest.param("tutorial001"), ], indirect=True, ) @@ -82,7 +82,7 @@ def test_tutorial001(print_mock: PrintMock, module: ModuleType): @pytest.mark.parametrize( "module", [ - pytest.param("tutorial002_py310"), + pytest.param("tutorial002"), ], indirect=True, ) diff --git a/tests/test_tutorial/test_fastapi/test_app_testing/test_tutorial001_tests001.py b/tests/test_tutorial/test_fastapi/test_app_testing/test_tutorial001_tests001.py index 5e31c012ac..cb97a7f800 100644 --- a/tests/test_tutorial/test_fastapi/test_app_testing/test_tutorial001_tests001.py +++ b/tests/test_tutorial/test_fastapi/test_app_testing/test_tutorial001_tests001.py @@ -15,7 +15,7 @@ class Modules: @pytest.fixture( name="modules_path", params=[ - pytest.param("tutorial001_py310"), + pytest.param("tutorial001"), ], ) def get_modules_path(request: pytest.FixtureRequest) -> str: diff --git a/tests/test_tutorial/test_fastapi/test_app_testing/test_tutorial001_tests002.py b/tests/test_tutorial/test_fastapi/test_app_testing/test_tutorial001_tests002.py index 43114fa3a9..1e2cbc1751 100644 --- a/tests/test_tutorial/test_fastapi/test_app_testing/test_tutorial001_tests002.py +++ b/tests/test_tutorial/test_fastapi/test_app_testing/test_tutorial001_tests002.py @@ -15,7 +15,7 @@ class Modules: @pytest.fixture( name="modules_path", params=[ - pytest.param("tutorial001_py310"), + pytest.param("tutorial001"), ], ) def get_modules_path(request: pytest.FixtureRequest) -> str: diff --git a/tests/test_tutorial/test_fastapi/test_app_testing/test_tutorial001_tests003.py b/tests/test_tutorial/test_fastapi/test_app_testing/test_tutorial001_tests003.py index 79423eeae4..3060c1fcd6 100644 --- a/tests/test_tutorial/test_fastapi/test_app_testing/test_tutorial001_tests003.py +++ b/tests/test_tutorial/test_fastapi/test_app_testing/test_tutorial001_tests003.py @@ -15,7 +15,7 @@ class Modules: @pytest.fixture( name="modules_path", params=[ - pytest.param("tutorial001_py310"), + pytest.param("tutorial001"), ], ) def get_modules_path(request: pytest.FixtureRequest) -> str: diff --git a/tests/test_tutorial/test_fastapi/test_app_testing/test_tutorial001_tests004.py b/tests/test_tutorial/test_fastapi/test_app_testing/test_tutorial001_tests004.py index 3e1e262ca5..9dc07a85df 100644 --- a/tests/test_tutorial/test_fastapi/test_app_testing/test_tutorial001_tests004.py +++ b/tests/test_tutorial/test_fastapi/test_app_testing/test_tutorial001_tests004.py @@ -15,7 +15,7 @@ class Modules: @pytest.fixture( name="modules_path", params=[ - pytest.param("tutorial001_py310"), + pytest.param("tutorial001"), ], ) def get_modules_path(request: pytest.FixtureRequest) -> str: diff --git a/tests/test_tutorial/test_fastapi/test_app_testing/test_tutorial001_tests005.py b/tests/test_tutorial/test_fastapi/test_app_testing/test_tutorial001_tests005.py index b8467ee447..9d27a94bf4 100644 --- a/tests/test_tutorial/test_fastapi/test_app_testing/test_tutorial001_tests005.py +++ b/tests/test_tutorial/test_fastapi/test_app_testing/test_tutorial001_tests005.py @@ -3,11 +3,11 @@ import pytest from sqlmodel import Session -from docs_src.tutorial.fastapi.app_testing.tutorial001_py310 import main as app_mod -from docs_src.tutorial.fastapi.app_testing.tutorial001_py310 import ( +from docs_src.tutorial.fastapi.app_testing.tutorial001 import main as app_mod +from docs_src.tutorial.fastapi.app_testing.tutorial001 import ( test_main_005 as test_mod, ) -from docs_src.tutorial.fastapi.app_testing.tutorial001_py310.test_main_005 import ( +from docs_src.tutorial.fastapi.app_testing.tutorial001.test_main_005 import ( session_fixture, ) diff --git a/tests/test_tutorial/test_fastapi/test_app_testing/test_tutorial001_tests006.py b/tests/test_tutorial/test_fastapi/test_app_testing/test_tutorial001_tests006.py index ae8e702153..33be4fb6d9 100644 --- a/tests/test_tutorial/test_fastapi/test_app_testing/test_tutorial001_tests006.py +++ b/tests/test_tutorial/test_fastapi/test_app_testing/test_tutorial001_tests006.py @@ -4,11 +4,11 @@ from fastapi.testclient import TestClient from sqlmodel import Session -from docs_src.tutorial.fastapi.app_testing.tutorial001_py310 import main as app_mod -from docs_src.tutorial.fastapi.app_testing.tutorial001_py310 import ( +from docs_src.tutorial.fastapi.app_testing.tutorial001 import main as app_mod +from docs_src.tutorial.fastapi.app_testing.tutorial001 import ( test_main_006 as test_mod, ) -from docs_src.tutorial.fastapi.app_testing.tutorial001_py310.test_main_006 import ( +from docs_src.tutorial.fastapi.app_testing.tutorial001.test_main_006 import ( client_fixture, session_fixture, ) diff --git a/tests/test_tutorial/test_fastapi/test_app_testing/test_tutorial001_tests_main.py b/tests/test_tutorial/test_fastapi/test_app_testing/test_tutorial001_tests_main.py index 56650ab4ce..68f68706c8 100644 --- a/tests/test_tutorial/test_fastapi/test_app_testing/test_tutorial001_tests_main.py +++ b/tests/test_tutorial/test_fastapi/test_app_testing/test_tutorial001_tests_main.py @@ -9,7 +9,7 @@ @pytest.fixture( name="module", params=[ - pytest.param("tutorial001_py310"), + pytest.param("tutorial001"), ], ) def get_module(request: pytest.FixtureRequest) -> ModuleType: diff --git a/tests/test_tutorial/test_fastapi/test_delete/test_tutorial001.py b/tests/test_tutorial/test_fastapi/test_delete/test_tutorial001.py index 9cf56131d4..e726b77b34 100644 --- a/tests/test_tutorial/test_fastapi/test_delete/test_tutorial001.py +++ b/tests/test_tutorial/test_fastapi/test_delete/test_tutorial001.py @@ -10,7 +10,7 @@ @pytest.fixture( name="module", params=[ - pytest.param("tutorial001_py310"), + pytest.param("tutorial001"), ], ) def get_module(request: pytest.FixtureRequest, database_engine: Engine) -> ModuleType: diff --git a/tests/test_tutorial/test_fastapi/test_limit_and_offset/test_tutorial001.py b/tests/test_tutorial/test_fastapi/test_limit_and_offset/test_tutorial001.py index 702ce61d7f..60d7792d9e 100644 --- a/tests/test_tutorial/test_fastapi/test_limit_and_offset/test_tutorial001.py +++ b/tests/test_tutorial/test_fastapi/test_limit_and_offset/test_tutorial001.py @@ -10,7 +10,7 @@ @pytest.fixture( name="module", params=[ - pytest.param("tutorial001_py310"), + pytest.param("tutorial001"), ], ) def get_module(request: pytest.FixtureRequest, database_engine: Engine) -> ModuleType: diff --git a/tests/test_tutorial/test_fastapi/test_multiple_models/test_tutorial001.py b/tests/test_tutorial/test_fastapi/test_multiple_models/test_tutorial001.py index 35faa201fd..01793eefbf 100644 --- a/tests/test_tutorial/test_fastapi/test_multiple_models/test_tutorial001.py +++ b/tests/test_tutorial/test_fastapi/test_multiple_models/test_tutorial001.py @@ -11,7 +11,7 @@ @pytest.fixture( name="module", params=[ - pytest.param("tutorial001_py310"), + pytest.param("tutorial001"), ], ) def get_module(request: pytest.FixtureRequest, database_engine: Engine) -> ModuleType: diff --git a/tests/test_tutorial/test_fastapi/test_multiple_models/test_tutorial002.py b/tests/test_tutorial/test_fastapi/test_multiple_models/test_tutorial002.py index 8f032ba922..a6aaed32a8 100644 --- a/tests/test_tutorial/test_fastapi/test_multiple_models/test_tutorial002.py +++ b/tests/test_tutorial/test_fastapi/test_multiple_models/test_tutorial002.py @@ -11,7 +11,7 @@ @pytest.fixture( name="module", params=[ - pytest.param("tutorial002_py310"), + pytest.param("tutorial002"), ], ) def get_module(request: pytest.FixtureRequest, database_engine: Engine) -> ModuleType: diff --git a/tests/test_tutorial/test_fastapi/test_read_one/test_tutorial001.py b/tests/test_tutorial/test_fastapi/test_read_one/test_tutorial001.py index 0feac29dde..62babedcf9 100644 --- a/tests/test_tutorial/test_fastapi/test_read_one/test_tutorial001.py +++ b/tests/test_tutorial/test_fastapi/test_read_one/test_tutorial001.py @@ -10,7 +10,7 @@ @pytest.fixture( name="module", params=[ - pytest.param("tutorial001_py310"), + pytest.param("tutorial001"), ], ) def get_module(request: pytest.FixtureRequest, database_engine: Engine) -> ModuleType: diff --git a/tests/test_tutorial/test_fastapi/test_relationships/test_tutorial001.py b/tests/test_tutorial/test_fastapi/test_relationships/test_tutorial001.py index 4fac2364eb..c1f876b429 100644 --- a/tests/test_tutorial/test_fastapi/test_relationships/test_tutorial001.py +++ b/tests/test_tutorial/test_fastapi/test_relationships/test_tutorial001.py @@ -10,7 +10,7 @@ @pytest.fixture( name="module", params=[ - pytest.param("tutorial001_py310"), + pytest.param("tutorial001"), ], ) def get_module(request: pytest.FixtureRequest, database_engine: Engine) -> ModuleType: diff --git a/tests/test_tutorial/test_fastapi/test_response_model/test_tutorial001.py b/tests/test_tutorial/test_fastapi/test_response_model/test_tutorial001.py index aa9a26bcbc..e8736422c8 100644 --- a/tests/test_tutorial/test_fastapi/test_response_model/test_tutorial001.py +++ b/tests/test_tutorial/test_fastapi/test_response_model/test_tutorial001.py @@ -10,7 +10,7 @@ @pytest.fixture( name="module", params=[ - pytest.param("tutorial001_py310"), + pytest.param("tutorial001"), ], ) def get_module(request: pytest.FixtureRequest, database_engine: Engine) -> ModuleType: diff --git a/tests/test_tutorial/test_fastapi/test_session_with_dependency/test_tutorial001.py b/tests/test_tutorial/test_fastapi/test_session_with_dependency/test_tutorial001.py index 3f1358d0e1..103dae3102 100644 --- a/tests/test_tutorial/test_fastapi/test_session_with_dependency/test_tutorial001.py +++ b/tests/test_tutorial/test_fastapi/test_session_with_dependency/test_tutorial001.py @@ -10,7 +10,7 @@ @pytest.fixture( name="module", params=[ - pytest.param("tutorial001_py310"), + pytest.param("tutorial001"), ], ) def get_module(request: pytest.FixtureRequest, database_engine: Engine) -> ModuleType: diff --git a/tests/test_tutorial/test_fastapi/test_simple_hero_api/test_tutorial001.py b/tests/test_tutorial/test_fastapi/test_simple_hero_api/test_tutorial001.py index 20dce60f69..9a2d7b99b3 100644 --- a/tests/test_tutorial/test_fastapi/test_simple_hero_api/test_tutorial001.py +++ b/tests/test_tutorial/test_fastapi/test_simple_hero_api/test_tutorial001.py @@ -10,7 +10,7 @@ @pytest.fixture( name="module", params=[ - pytest.param("tutorial001_py310"), + pytest.param("tutorial001"), ], ) def get_module(request: pytest.FixtureRequest, database_engine: Engine) -> ModuleType: diff --git a/tests/test_tutorial/test_fastapi/test_teams/test_tutorial001.py b/tests/test_tutorial/test_fastapi/test_teams/test_tutorial001.py index b532b4795d..ad27c8be6b 100644 --- a/tests/test_tutorial/test_fastapi/test_teams/test_tutorial001.py +++ b/tests/test_tutorial/test_fastapi/test_teams/test_tutorial001.py @@ -10,7 +10,7 @@ @pytest.fixture( name="module", params=[ - pytest.param("tutorial001_py310"), + pytest.param("tutorial001"), ], ) def get_module(request: pytest.FixtureRequest, database_engine: Engine) -> ModuleType: diff --git a/tests/test_tutorial/test_fastapi/test_update/test_tutorial001.py b/tests/test_tutorial/test_fastapi/test_update/test_tutorial001.py index 085f71a866..1c70acb979 100644 --- a/tests/test_tutorial/test_fastapi/test_update/test_tutorial001.py +++ b/tests/test_tutorial/test_fastapi/test_update/test_tutorial001.py @@ -10,7 +10,7 @@ @pytest.fixture( name="module", params=[ - pytest.param("tutorial001_py310"), + pytest.param("tutorial001"), ], ) def get_module(request: pytest.FixtureRequest, database_engine: Engine) -> ModuleType: diff --git a/tests/test_tutorial/test_fastapi/test_update/test_tutorial002.py b/tests/test_tutorial/test_fastapi/test_update/test_tutorial002.py index ae4b4e6e9b..89e443a089 100644 --- a/tests/test_tutorial/test_fastapi/test_update/test_tutorial002.py +++ b/tests/test_tutorial/test_fastapi/test_update/test_tutorial002.py @@ -11,7 +11,7 @@ @pytest.fixture( name="module", params=[ - pytest.param("tutorial002_py310"), + pytest.param("tutorial002"), ], ) def get_module(request: pytest.FixtureRequest, database_engine: Engine) -> ModuleType: diff --git a/tests/test_tutorial/test_indexes/test_tutorial001.py b/tests/test_tutorial/test_indexes/test_tutorial001.py index e92ce78d50..0b57372843 100644 --- a/tests/test_tutorial/test_indexes/test_tutorial001.py +++ b/tests/test_tutorial/test_indexes/test_tutorial001.py @@ -11,7 +11,7 @@ @pytest.fixture( name="mod", params=[ - pytest.param("tutorial001_py310"), + pytest.param("tutorial001"), ], ) def get_module(request: pytest.FixtureRequest, database_engine: Engine) -> ModuleType: diff --git a/tests/test_tutorial/test_indexes/test_tutorial002.py b/tests/test_tutorial/test_indexes/test_tutorial002.py index 44806ff197..38cb5324d5 100644 --- a/tests/test_tutorial/test_indexes/test_tutorial002.py +++ b/tests/test_tutorial/test_indexes/test_tutorial002.py @@ -11,7 +11,7 @@ @pytest.fixture( name="mod", params=[ - pytest.param("tutorial002_py310"), + pytest.param("tutorial002"), ], ) def get_module(request: pytest.FixtureRequest, database_engine: Engine) -> ModuleType: diff --git a/tests/test_tutorial/test_insert/test_tutorial001.py b/tests/test_tutorial/test_insert/test_tutorial001.py index 2fea0482bb..9507904d96 100644 --- a/tests/test_tutorial/test_insert/test_tutorial001.py +++ b/tests/test_tutorial/test_insert/test_tutorial001.py @@ -9,7 +9,7 @@ @pytest.fixture( name="mod", params=[ - pytest.param("tutorial001_py310"), + pytest.param("tutorial001"), ], ) def get_module(request: pytest.FixtureRequest, database_engine: Engine) -> ModuleType: diff --git a/tests/test_tutorial/test_insert/test_tutorial002.py b/tests/test_tutorial/test_insert/test_tutorial002.py index 7d9a39b149..0944b800f7 100644 --- a/tests/test_tutorial/test_insert/test_tutorial002.py +++ b/tests/test_tutorial/test_insert/test_tutorial002.py @@ -9,7 +9,7 @@ @pytest.fixture( name="mod", params=[ - pytest.param("tutorial002_py310"), + pytest.param("tutorial002"), ], ) def get_module(request: pytest.FixtureRequest, database_engine: Engine) -> ModuleType: diff --git a/tests/test_tutorial/test_insert/test_tutorial003.py b/tests/test_tutorial/test_insert/test_tutorial003.py index c340adc562..0a34d7a888 100644 --- a/tests/test_tutorial/test_insert/test_tutorial003.py +++ b/tests/test_tutorial/test_insert/test_tutorial003.py @@ -9,7 +9,7 @@ @pytest.fixture( name="mod", params=[ - pytest.param("tutorial003_py310"), + pytest.param("tutorial003"), ], ) def get_module(request: pytest.FixtureRequest, database_engine: Engine) -> ModuleType: diff --git a/tests/test_tutorial/test_limit_and_offset/test_tutorial001.py b/tests/test_tutorial/test_limit_and_offset/test_tutorial001.py index b8696aa194..72b813ff9d 100644 --- a/tests/test_tutorial/test_limit_and_offset/test_tutorial001.py +++ b/tests/test_tutorial/test_limit_and_offset/test_tutorial001.py @@ -10,7 +10,7 @@ @pytest.fixture( name="mod", params=[ - pytest.param("tutorial001_py310"), + pytest.param("tutorial001"), ], ) def get_module(request: pytest.FixtureRequest, database_engine: Engine) -> ModuleType: diff --git a/tests/test_tutorial/test_limit_and_offset/test_tutorial002.py b/tests/test_tutorial/test_limit_and_offset/test_tutorial002.py index 0904eedfc3..4fa477a364 100644 --- a/tests/test_tutorial/test_limit_and_offset/test_tutorial002.py +++ b/tests/test_tutorial/test_limit_and_offset/test_tutorial002.py @@ -10,7 +10,7 @@ @pytest.fixture( name="mod", params=[ - pytest.param("tutorial002_py310"), + pytest.param("tutorial002"), ], ) def get_module(request: pytest.FixtureRequest, database_engine: Engine) -> ModuleType: diff --git a/tests/test_tutorial/test_limit_and_offset/test_tutorial003.py b/tests/test_tutorial/test_limit_and_offset/test_tutorial003.py index 6e53aba174..e48023dc13 100644 --- a/tests/test_tutorial/test_limit_and_offset/test_tutorial003.py +++ b/tests/test_tutorial/test_limit_and_offset/test_tutorial003.py @@ -10,7 +10,7 @@ @pytest.fixture( name="mod", params=[ - pytest.param("tutorial003_py310"), + pytest.param("tutorial003"), ], ) def get_module(request: pytest.FixtureRequest, database_engine: Engine) -> ModuleType: diff --git a/tests/test_tutorial/test_limit_and_offset/test_tutorial004.py b/tests/test_tutorial/test_limit_and_offset/test_tutorial004.py index 9c6c02af6b..5818c380bc 100644 --- a/tests/test_tutorial/test_limit_and_offset/test_tutorial004.py +++ b/tests/test_tutorial/test_limit_and_offset/test_tutorial004.py @@ -10,7 +10,7 @@ @pytest.fixture( name="mod", params=[ - pytest.param("tutorial004_py310"), + pytest.param("tutorial004"), ], ) def get_module(request: pytest.FixtureRequest, database_engine: Engine) -> ModuleType: diff --git a/tests/test_tutorial/test_many_to_many/test_tutorial001.py b/tests/test_tutorial/test_many_to_many/test_tutorial001.py index 9cec6a3750..d852cd6bbb 100644 --- a/tests/test_tutorial/test_many_to_many/test_tutorial001.py +++ b/tests/test_tutorial/test_many_to_many/test_tutorial001.py @@ -11,7 +11,7 @@ @pytest.fixture( name="mod", params=[ - pytest.param("tutorial001_py310"), + pytest.param("tutorial001"), ], ) def get_module(request: pytest.FixtureRequest, database_engine: Engine) -> ModuleType: diff --git a/tests/test_tutorial/test_many_to_many/test_tutorial002.py b/tests/test_tutorial/test_many_to_many/test_tutorial002.py index 962375b13d..9f57ca334e 100644 --- a/tests/test_tutorial/test_many_to_many/test_tutorial002.py +++ b/tests/test_tutorial/test_many_to_many/test_tutorial002.py @@ -11,7 +11,7 @@ @pytest.fixture( name="mod", params=[ - pytest.param("tutorial002_py310"), + pytest.param("tutorial002"), ], ) def get_module(request: pytest.FixtureRequest, database_engine: Engine) -> ModuleType: diff --git a/tests/test_tutorial/test_many_to_many/test_tutorial003.py b/tests/test_tutorial/test_many_to_many/test_tutorial003.py index 36e5a28aa1..376ff8dc5c 100644 --- a/tests/test_tutorial/test_many_to_many/test_tutorial003.py +++ b/tests/test_tutorial/test_many_to_many/test_tutorial003.py @@ -11,7 +11,7 @@ @pytest.fixture( name="mod", params=[ - pytest.param("tutorial003_py310"), + pytest.param("tutorial003"), ], ) def get_module(request: pytest.FixtureRequest, database_engine: Engine) -> ModuleType: diff --git a/tests/test_tutorial/test_one/test_tutorial001.py b/tests/test_tutorial/test_one/test_tutorial001.py index b6740805ae..2de129e3df 100644 --- a/tests/test_tutorial/test_one/test_tutorial001.py +++ b/tests/test_tutorial/test_one/test_tutorial001.py @@ -10,7 +10,7 @@ @pytest.fixture( name="mod", params=[ - pytest.param("tutorial001_py310"), + pytest.param("tutorial001"), ], ) def get_module(request: pytest.FixtureRequest, database_engine: Engine) -> ModuleType: diff --git a/tests/test_tutorial/test_one/test_tutorial002.py b/tests/test_tutorial/test_one/test_tutorial002.py index ccc8bdd2a3..07cd836246 100644 --- a/tests/test_tutorial/test_one/test_tutorial002.py +++ b/tests/test_tutorial/test_one/test_tutorial002.py @@ -10,7 +10,7 @@ @pytest.fixture( name="mod", params=[ - pytest.param("tutorial002_py310"), + pytest.param("tutorial002"), ], ) def get_module(request: pytest.FixtureRequest, database_engine: Engine) -> ModuleType: diff --git a/tests/test_tutorial/test_one/test_tutorial003.py b/tests/test_tutorial/test_one/test_tutorial003.py index c610be5dac..b36a1283c5 100644 --- a/tests/test_tutorial/test_one/test_tutorial003.py +++ b/tests/test_tutorial/test_one/test_tutorial003.py @@ -10,7 +10,7 @@ @pytest.fixture( name="mod", params=[ - pytest.param("tutorial003_py310"), + pytest.param("tutorial003"), ], ) def get_module(request: pytest.FixtureRequest, database_engine: Engine) -> ModuleType: diff --git a/tests/test_tutorial/test_one/test_tutorial004.py b/tests/test_tutorial/test_one/test_tutorial004.py index f598437a11..6e7a520fda 100644 --- a/tests/test_tutorial/test_one/test_tutorial004.py +++ b/tests/test_tutorial/test_one/test_tutorial004.py @@ -12,7 +12,7 @@ @pytest.fixture( name="mod", params=[ - pytest.param("tutorial004_py310"), + pytest.param("tutorial004"), ], ) def get_module(request: pytest.FixtureRequest, database_engine: Engine) -> ModuleType: diff --git a/tests/test_tutorial/test_one/test_tutorial005.py b/tests/test_tutorial/test_one/test_tutorial005.py index 908fe6687a..328da55cc5 100644 --- a/tests/test_tutorial/test_one/test_tutorial005.py +++ b/tests/test_tutorial/test_one/test_tutorial005.py @@ -12,7 +12,7 @@ @pytest.fixture( name="mod", params=[ - pytest.param("tutorial005_py310"), + pytest.param("tutorial005"), ], ) def get_module(request: pytest.FixtureRequest, database_engine: Engine) -> ModuleType: diff --git a/tests/test_tutorial/test_one/test_tutorial006.py b/tests/test_tutorial/test_one/test_tutorial006.py index f5839a23a4..8c93da2006 100644 --- a/tests/test_tutorial/test_one/test_tutorial006.py +++ b/tests/test_tutorial/test_one/test_tutorial006.py @@ -10,7 +10,7 @@ @pytest.fixture( name="mod", params=[ - pytest.param("tutorial006_py310"), + pytest.param("tutorial006"), ], ) def get_module(request: pytest.FixtureRequest, database_engine: Engine) -> ModuleType: diff --git a/tests/test_tutorial/test_one/test_tutorial007.py b/tests/test_tutorial/test_one/test_tutorial007.py index babaa57e78..94e76e2dfe 100644 --- a/tests/test_tutorial/test_one/test_tutorial007.py +++ b/tests/test_tutorial/test_one/test_tutorial007.py @@ -10,7 +10,7 @@ @pytest.fixture( name="mod", params=[ - pytest.param("tutorial007_py310"), + pytest.param("tutorial007"), ], ) def get_module(request: pytest.FixtureRequest, database_engine: Engine) -> ModuleType: diff --git a/tests/test_tutorial/test_one/test_tutorial008.py b/tests/test_tutorial/test_one/test_tutorial008.py index 70de2170f6..1b96c82120 100644 --- a/tests/test_tutorial/test_one/test_tutorial008.py +++ b/tests/test_tutorial/test_one/test_tutorial008.py @@ -10,7 +10,7 @@ @pytest.fixture( name="mod", params=[ - pytest.param("tutorial008_py310"), + pytest.param("tutorial008"), ], ) def get_module(request: pytest.FixtureRequest, database_engine: Engine) -> ModuleType: diff --git a/tests/test_tutorial/test_one/test_tutorial009.py b/tests/test_tutorial/test_one/test_tutorial009.py index 0fb9f54baf..9e8d09f886 100644 --- a/tests/test_tutorial/test_one/test_tutorial009.py +++ b/tests/test_tutorial/test_one/test_tutorial009.py @@ -10,7 +10,7 @@ @pytest.fixture( name="mod", params=[ - pytest.param("tutorial009_py310"), + pytest.param("tutorial009"), ], ) def get_module(request: pytest.FixtureRequest, database_engine: Engine) -> ModuleType: diff --git a/tests/test_tutorial/test_relationship_attributes/test_back_populates/test_tutorial001.py b/tests/test_tutorial/test_relationship_attributes/test_back_populates/test_tutorial001.py index b5a3e00bf1..5940b8a895 100644 --- a/tests/test_tutorial/test_relationship_attributes/test_back_populates/test_tutorial001.py +++ b/tests/test_tutorial/test_relationship_attributes/test_back_populates/test_tutorial001.py @@ -11,7 +11,7 @@ @pytest.fixture( name="mod", params=[ - pytest.param("tutorial001_py310"), + pytest.param("tutorial001"), ], ) def get_module(request: pytest.FixtureRequest, database_engine: Engine) -> ModuleType: diff --git a/tests/test_tutorial/test_relationship_attributes/test_back_populates/test_tutorial002.py b/tests/test_tutorial/test_relationship_attributes/test_back_populates/test_tutorial002.py index addfa1a4e9..bbdba89dc8 100644 --- a/tests/test_tutorial/test_relationship_attributes/test_back_populates/test_tutorial002.py +++ b/tests/test_tutorial/test_relationship_attributes/test_back_populates/test_tutorial002.py @@ -10,7 +10,7 @@ @pytest.fixture( name="mod", params=[ - pytest.param("tutorial002_py310"), + pytest.param("tutorial002"), ], ) def get_module(request: pytest.FixtureRequest, database_engine: Engine) -> ModuleType: diff --git a/tests/test_tutorial/test_relationship_attributes/test_back_populates/test_tutorial003.py b/tests/test_tutorial/test_relationship_attributes/test_back_populates/test_tutorial003.py index 48e33c9ba2..bfc997c44a 100644 --- a/tests/test_tutorial/test_relationship_attributes/test_back_populates/test_tutorial003.py +++ b/tests/test_tutorial/test_relationship_attributes/test_back_populates/test_tutorial003.py @@ -9,7 +9,7 @@ @pytest.fixture( name="mod", params=[ - pytest.param("tutorial003_py310"), + pytest.param("tutorial003"), ], ) def get_module(request: pytest.FixtureRequest, database_engine: Engine) -> ModuleType: diff --git a/tests/test_tutorial/test_relationship_attributes/test_create_and_update_relationships/test_tutorial001.py b/tests/test_tutorial/test_relationship_attributes/test_create_and_update_relationships/test_tutorial001.py index 2dcea1cd6c..2d368abb90 100644 --- a/tests/test_tutorial/test_relationship_attributes/test_create_and_update_relationships/test_tutorial001.py +++ b/tests/test_tutorial/test_relationship_attributes/test_create_and_update_relationships/test_tutorial001.py @@ -10,7 +10,7 @@ @pytest.fixture( name="mod", params=[ - pytest.param("tutorial001_py310"), + pytest.param("tutorial001"), ], ) def get_module(request: pytest.FixtureRequest, database_engine: Engine) -> ModuleType: diff --git a/tests/test_tutorial/test_relationship_attributes/test_define_relationship_attributes/test_tutorial001.py b/tests/test_tutorial/test_relationship_attributes/test_define_relationship_attributes/test_tutorial001.py index 0285526205..59f7c9cdb9 100644 --- a/tests/test_tutorial/test_relationship_attributes/test_define_relationship_attributes/test_tutorial001.py +++ b/tests/test_tutorial/test_relationship_attributes/test_define_relationship_attributes/test_tutorial001.py @@ -10,7 +10,7 @@ @pytest.fixture( name="mod", params=[ - pytest.param("tutorial001_py310"), + pytest.param("tutorial001"), ], ) def get_module(request: pytest.FixtureRequest, database_engine: Engine) -> ModuleType: diff --git a/tests/test_tutorial/test_relationship_attributes/test_delete_records_relationship/test_tutorial001.py b/tests/test_tutorial/test_relationship_attributes/test_delete_records_relationship/test_tutorial001.py index f0c176955d..540920e4ee 100644 --- a/tests/test_tutorial/test_relationship_attributes/test_delete_records_relationship/test_tutorial001.py +++ b/tests/test_tutorial/test_relationship_attributes/test_delete_records_relationship/test_tutorial001.py @@ -10,7 +10,7 @@ @pytest.fixture( name="mod", params=[ - pytest.param("tutorial001_py310"), + pytest.param("tutorial001"), ], ) def get_module(request: pytest.FixtureRequest, database_engine: Engine) -> ModuleType: diff --git a/tests/test_tutorial/test_relationship_attributes/test_delete_records_relationship/test_tutorial002.py b/tests/test_tutorial/test_relationship_attributes/test_delete_records_relationship/test_tutorial002.py index fed274e009..053b11ef66 100644 --- a/tests/test_tutorial/test_relationship_attributes/test_delete_records_relationship/test_tutorial002.py +++ b/tests/test_tutorial/test_relationship_attributes/test_delete_records_relationship/test_tutorial002.py @@ -10,7 +10,7 @@ @pytest.fixture( name="mod", params=[ - pytest.param("tutorial002_py310"), + pytest.param("tutorial002"), ], ) def get_module(request: pytest.FixtureRequest, database_engine: Engine) -> ModuleType: diff --git a/tests/test_tutorial/test_relationship_attributes/test_delete_records_relationship/test_tutorial003.py b/tests/test_tutorial/test_relationship_attributes/test_delete_records_relationship/test_tutorial003.py index 5b41c2e02c..7d4d593238 100644 --- a/tests/test_tutorial/test_relationship_attributes/test_delete_records_relationship/test_tutorial003.py +++ b/tests/test_tutorial/test_relationship_attributes/test_delete_records_relationship/test_tutorial003.py @@ -10,7 +10,7 @@ @pytest.fixture( name="mod", params=[ - pytest.param("tutorial003_py310"), + pytest.param("tutorial003"), ], ) def get_module(request: pytest.FixtureRequest, database_engine: Engine) -> ModuleType: diff --git a/tests/test_tutorial/test_relationship_attributes/test_delete_records_relationship/test_tutorial004.py b/tests/test_tutorial/test_relationship_attributes/test_delete_records_relationship/test_tutorial004.py index 77000933bb..4506345067 100644 --- a/tests/test_tutorial/test_relationship_attributes/test_delete_records_relationship/test_tutorial004.py +++ b/tests/test_tutorial/test_relationship_attributes/test_delete_records_relationship/test_tutorial004.py @@ -12,7 +12,7 @@ @pytest.fixture( name="mod", params=[ - pytest.param("tutorial004_py310"), + pytest.param("tutorial004"), ], ) def get_module(request: pytest.FixtureRequest, database_engine: Engine) -> ModuleType: diff --git a/tests/test_tutorial/test_relationship_attributes/test_delete_records_relationship/test_tutorial005.py b/tests/test_tutorial/test_relationship_attributes/test_delete_records_relationship/test_tutorial005.py index 39c2364f31..cdff70c1ae 100644 --- a/tests/test_tutorial/test_relationship_attributes/test_delete_records_relationship/test_tutorial005.py +++ b/tests/test_tutorial/test_relationship_attributes/test_delete_records_relationship/test_tutorial005.py @@ -10,7 +10,7 @@ @pytest.fixture( name="mod", params=[ - pytest.param("tutorial005_py310"), + pytest.param("tutorial005"), ], ) def get_module(request: pytest.FixtureRequest, database_engine: Engine) -> ModuleType: diff --git a/tests/test_tutorial/test_relationship_attributes/test_read_relationships/test_tutorial001.py b/tests/test_tutorial/test_relationship_attributes/test_read_relationships/test_tutorial001.py index 5569e8ab0f..249daa4c1d 100644 --- a/tests/test_tutorial/test_relationship_attributes/test_read_relationships/test_tutorial001.py +++ b/tests/test_tutorial/test_relationship_attributes/test_read_relationships/test_tutorial001.py @@ -10,7 +10,7 @@ @pytest.fixture( name="mod", params=[ - pytest.param("tutorial001_py310"), + pytest.param("tutorial001"), ], ) def get_module(request: pytest.FixtureRequest, database_engine: Engine) -> ModuleType: diff --git a/tests/test_tutorial/test_relationship_attributes/test_read_relationships/test_tutorial002.py b/tests/test_tutorial/test_relationship_attributes/test_read_relationships/test_tutorial002.py index 28a38cb993..3162595a58 100644 --- a/tests/test_tutorial/test_relationship_attributes/test_read_relationships/test_tutorial002.py +++ b/tests/test_tutorial/test_relationship_attributes/test_read_relationships/test_tutorial002.py @@ -10,7 +10,7 @@ @pytest.fixture( name="mod", params=[ - pytest.param("tutorial002_py310"), + pytest.param("tutorial002"), ], ) def get_module(request: pytest.FixtureRequest, database_engine: Engine) -> ModuleType: diff --git a/tests/test_tutorial/test_select/test_tutorial001_tutorial002.py b/tests/test_tutorial/test_select/test_tutorial001_tutorial002.py index cb35370601..907bd2f5fd 100644 --- a/tests/test_tutorial/test_select/test_tutorial001_tutorial002.py +++ b/tests/test_tutorial/test_select/test_tutorial001_tutorial002.py @@ -39,7 +39,7 @@ def get_module(request: pytest.FixtureRequest, database_engine: Engine) -> Modul @pytest.mark.parametrize( "module", [ - pytest.param("tutorial001_py310"), + pytest.param("tutorial001"), ], indirect=True, ) @@ -51,7 +51,7 @@ def test_tutorial_001(print_mock: PrintMock, module: ModuleType): @pytest.mark.parametrize( "module", [ - pytest.param("tutorial002_py310"), + pytest.param("tutorial002"), ], indirect=True, ) diff --git a/tests/test_tutorial/test_select/test_tutorial003_tutorial004.py b/tests/test_tutorial/test_select/test_tutorial003_tutorial004.py index 4f04037155..53ae48f41d 100644 --- a/tests/test_tutorial/test_select/test_tutorial003_tutorial004.py +++ b/tests/test_tutorial/test_select/test_tutorial003_tutorial004.py @@ -41,7 +41,7 @@ def get_module(request: pytest.FixtureRequest, database_engine: Engine) -> Modul @pytest.mark.parametrize( "module", [ - pytest.param("tutorial003_py310"), + pytest.param("tutorial003"), ], indirect=True, ) @@ -53,7 +53,7 @@ def test_tutorial_003(print_mock: PrintMock, module: ModuleType): @pytest.mark.parametrize( "module", [ - pytest.param("tutorial004_py310"), + pytest.param("tutorial004"), ], indirect=True, ) diff --git a/tests/test_tutorial/test_update/test_tutorial001_tutorial002.py b/tests/test_tutorial/test_update/test_tutorial001_tutorial002.py index 20b5dc2107..214a2f0a49 100644 --- a/tests/test_tutorial/test_update/test_tutorial001_tutorial002.py +++ b/tests/test_tutorial/test_update/test_tutorial001_tutorial002.py @@ -38,7 +38,7 @@ def get_module(request: pytest.FixtureRequest, database_engine: Engine) -> Modul @pytest.mark.parametrize( "module", [ - pytest.param("tutorial001_py310"), + pytest.param("tutorial001"), ], indirect=True, ) @@ -50,7 +50,7 @@ def test_tutorial001(print_mock: PrintMock, module: ModuleType): @pytest.mark.parametrize( "module", [ - pytest.param("tutorial002_py310"), + pytest.param("tutorial002"), ], indirect=True, ) diff --git a/tests/test_tutorial/test_update/test_tutorial003_tutorial004.py b/tests/test_tutorial/test_update/test_tutorial003_tutorial004.py index fca7ef0bdb..bbd0b500cc 100644 --- a/tests/test_tutorial/test_update/test_tutorial003_tutorial004.py +++ b/tests/test_tutorial/test_update/test_tutorial003_tutorial004.py @@ -51,7 +51,7 @@ def get_module(request: pytest.FixtureRequest, database_engine: Engine) -> Modul @pytest.mark.parametrize( "module", [ - pytest.param("tutorial003_py310"), + pytest.param("tutorial003"), ], indirect=True, ) @@ -63,7 +63,7 @@ def test_tutorial003(print_mock: PrintMock, module: ModuleType): @pytest.mark.parametrize( "module", [ - pytest.param("tutorial004_py310"), + pytest.param("tutorial004"), ], indirect=True, ) diff --git a/tests/test_tutorial/test_where/test_tutorial001.py b/tests/test_tutorial/test_where/test_tutorial001.py index 7d8cce1111..ece404c2e6 100644 --- a/tests/test_tutorial/test_where/test_tutorial001.py +++ b/tests/test_tutorial/test_where/test_tutorial001.py @@ -10,7 +10,7 @@ @pytest.fixture( name="mod", params=[ - pytest.param("tutorial001_py310"), + pytest.param("tutorial001"), ], ) def get_module(request: pytest.FixtureRequest, database_engine: Engine) -> ModuleType: diff --git a/tests/test_tutorial/test_where/test_tutorial002.py b/tests/test_tutorial/test_where/test_tutorial002.py index 4aa4cc1f08..d01cae596d 100644 --- a/tests/test_tutorial/test_where/test_tutorial002.py +++ b/tests/test_tutorial/test_where/test_tutorial002.py @@ -10,7 +10,7 @@ @pytest.fixture( name="mod", params=[ - pytest.param("tutorial002_py310"), + pytest.param("tutorial002"), ], ) def get_module(request: pytest.FixtureRequest, database_engine: Engine) -> ModuleType: diff --git a/tests/test_tutorial/test_where/test_tutorial003.py b/tests/test_tutorial/test_where/test_tutorial003.py index 8dca60b79c..2ed0828826 100644 --- a/tests/test_tutorial/test_where/test_tutorial003.py +++ b/tests/test_tutorial/test_where/test_tutorial003.py @@ -10,7 +10,7 @@ @pytest.fixture( name="mod", params=[ - pytest.param("tutorial003_py310"), + pytest.param("tutorial003"), ], ) def get_module(request: pytest.FixtureRequest, database_engine: Engine) -> ModuleType: diff --git a/tests/test_tutorial/test_where/test_tutorial004.py b/tests/test_tutorial/test_where/test_tutorial004.py index cc3293233d..77b5b6356c 100644 --- a/tests/test_tutorial/test_where/test_tutorial004.py +++ b/tests/test_tutorial/test_where/test_tutorial004.py @@ -10,7 +10,7 @@ @pytest.fixture( name="mod", params=[ - pytest.param("tutorial004_py310"), + pytest.param("tutorial004"), ], ) def get_module(request: pytest.FixtureRequest, database_engine: Engine) -> ModuleType: diff --git a/tests/test_tutorial/test_where/test_tutorial005.py b/tests/test_tutorial/test_where/test_tutorial005.py index 1f367ed95f..bb25b716a2 100644 --- a/tests/test_tutorial/test_where/test_tutorial005.py +++ b/tests/test_tutorial/test_where/test_tutorial005.py @@ -10,7 +10,7 @@ @pytest.fixture( name="mod", params=[ - pytest.param("tutorial005_py310"), + pytest.param("tutorial005"), ], ) def get_module(request: pytest.FixtureRequest, database_engine: Engine) -> ModuleType: diff --git a/tests/test_tutorial/test_where/test_tutorial006.py b/tests/test_tutorial/test_where/test_tutorial006.py index d6b63ee19c..f7a53dcf5a 100644 --- a/tests/test_tutorial/test_where/test_tutorial006.py +++ b/tests/test_tutorial/test_where/test_tutorial006.py @@ -10,7 +10,7 @@ @pytest.fixture( name="mod", params=[ - pytest.param("tutorial006_py310"), + pytest.param("tutorial006"), ], ) def get_module(request: pytest.FixtureRequest, database_engine: Engine) -> ModuleType: diff --git a/tests/test_tutorial/test_where/test_tutorial006b.py b/tests/test_tutorial/test_where/test_tutorial006b.py index 134508fd11..6bbff434c8 100644 --- a/tests/test_tutorial/test_where/test_tutorial006b.py +++ b/tests/test_tutorial/test_where/test_tutorial006b.py @@ -10,7 +10,7 @@ @pytest.fixture( name="mod", params=[ - pytest.param("tutorial006b_py310"), + pytest.param("tutorial006b"), ], ) def get_module(request: pytest.FixtureRequest, database_engine: Engine) -> ModuleType: diff --git a/tests/test_tutorial/test_where/test_tutorial007.py b/tests/test_tutorial/test_where/test_tutorial007.py index 64bcaa0d79..5f080894d4 100644 --- a/tests/test_tutorial/test_where/test_tutorial007.py +++ b/tests/test_tutorial/test_where/test_tutorial007.py @@ -10,7 +10,7 @@ @pytest.fixture( name="mod", params=[ - pytest.param("tutorial007_py310"), + pytest.param("tutorial007"), ], ) def get_module(request: pytest.FixtureRequest, database_engine: Engine) -> ModuleType: diff --git a/tests/test_tutorial/test_where/test_tutorial008.py b/tests/test_tutorial/test_where/test_tutorial008.py index 48e6a80177..5ab3214df3 100644 --- a/tests/test_tutorial/test_where/test_tutorial008.py +++ b/tests/test_tutorial/test_where/test_tutorial008.py @@ -10,7 +10,7 @@ @pytest.fixture( name="mod", params=[ - pytest.param("tutorial008_py310"), + pytest.param("tutorial008"), ], ) def get_module(request: pytest.FixtureRequest, database_engine: Engine) -> ModuleType: diff --git a/tests/test_tutorial/test_where/test_tutorial009.py b/tests/test_tutorial/test_where/test_tutorial009.py index a818de990a..504cad6030 100644 --- a/tests/test_tutorial/test_where/test_tutorial009.py +++ b/tests/test_tutorial/test_where/test_tutorial009.py @@ -10,7 +10,7 @@ @pytest.fixture( name="mod", params=[ - pytest.param("tutorial009_py310"), + pytest.param("tutorial009"), ], ) def get_module(request: pytest.FixtureRequest, database_engine: Engine) -> ModuleType: diff --git a/tests/test_tutorial/test_where/test_tutorial011.py b/tests/test_tutorial/test_where/test_tutorial011.py index 78600447f0..f8953f8cdd 100644 --- a/tests/test_tutorial/test_where/test_tutorial011.py +++ b/tests/test_tutorial/test_where/test_tutorial011.py @@ -10,7 +10,7 @@ @pytest.fixture( name="mod", params=[ - pytest.param("tutorial011_py310"), + pytest.param("tutorial011"), ], ) def get_module(request: pytest.FixtureRequest, database_engine: Engine) -> ModuleType: