From df84ec2f5bb70ba3a7511d00f02d58816c5ddfb3 Mon Sep 17 00:00:00 2001 From: Kani Kim Date: Wed, 11 Jan 2023 08:10:19 +0900 Subject: [PATCH] Add language selection for docs, and Add UI py typer --- docs/en/data/external_links.yml | 0 docs/en/data/github_sponsors.yml | 0 docs/en/data/people.yml | 0 docs/en/data/sponsors.yml | 0 docs/en/data/sponsors_badge.yml | 0 docs/{ => en/docs}/advanced/decimal.md | 12 +- docs/{ => en/docs}/advanced/index.md | 0 docs/{ => en/docs}/alternatives.md | 0 docs/{ => en/docs}/contributing.md | 2 +- docs/{ => en/docs}/css/custom.css | 0 docs/{ => en/docs}/css/termynal.css | 0 docs/{ => en/docs}/databases.md | 0 docs/{ => en/docs}/db-to-code.md | 0 docs/{ => en/docs}/features.md | 0 docs/{ => en/docs}/help.md | 0 .../image001.png | Bin .../image002.png | Bin .../image003.png | Bin .../image004.png | Bin .../image005.png | Bin .../image006.png | Bin .../image007.png | Bin .../image008.png | Bin .../image009.png | Bin .../image010.png | Bin .../create-db-and-table/inline-errors01.png | Bin .../img/databases/external-server.drawio | 0 .../docs}/img/databases/external-server.svg | 0 .../img/databases/multiple-servers.drawio | 0 .../docs}/img/databases/multiple-servers.svg | 0 .../docs}/img/databases/relationships.drawio | 0 .../docs}/img/databases/relationships.svg | 0 .../docs}/img/databases/same-server.drawio | 0 .../docs}/img/databases/same-server.svg | 0 .../docs}/img/databases/single-file.drawio | 0 .../docs}/img/databases/single-file.svg | 0 .../docs}/img/db-to-code/autocompletion01.png | Bin .../docs}/img/db-to-code/mapper.drawio | 0 docs/{ => en/docs}/img/db-to-code/mapper.svg | 0 docs/{ => en/docs}/img/favicon.png | Bin .../docs}/img/features/autocompletion01.png | Bin .../docs}/img/github-social-preview.png | Bin .../docs}/img/github-social-preview.svg | 0 docs/{ => en/docs}/img/icon-white.svg | 0 docs/{ => en/docs}/img/icon.svg | 0 .../docs}/img/index/autocompletion01.png | Bin .../docs}/img/index/autocompletion02.png | Bin .../docs}/img/index/inline-errors01.png | Bin .../img/logo-margin/logo-margin-vector.svg | 0 .../docs}/img/logo-margin/logo-margin.svg | 0 .../docs}/img/tutorial/delete/image01.png | Bin .../fastapi/limit-and-offset/image01.png | Bin .../fastapi/multiple-models/image01.png | Bin .../fastapi/multiple-models/image02.png | Bin .../fastapi/multiple-models/image03.png | Bin .../img/tutorial/fastapi/read-one/image01.png | Bin .../fastapi/relationships/image01.png | Bin .../fastapi/relationships/image02.png | Bin .../fastapi/relationships/image03.png | Bin .../fastapi/relationships/image04.png | Bin .../fastapi/response-model/image01.png | Bin .../fastapi/response-model/image02.png | Bin .../fastapi/simple-hero-api/db-browser-01.png | Bin .../fastapi/simple-hero-api/image01.png | Bin .../fastapi/simple-hero-api/image02.png | Bin .../img/tutorial/fastapi/teams/image01.png | Bin .../img/tutorial/indexes/dictionary001.drawio | 0 .../img/tutorial/indexes/dictionary001.svg | 0 .../img/tutorial/indexes/dictionary002.drawio | 0 .../img/tutorial/indexes/dictionary002.svg | 0 .../img/tutorial/indexes/dictionary003.drawio | 0 .../img/tutorial/indexes/dictionary003.svg | 0 .../img/tutorial/indexes/dictionary004.drawio | 0 .../img/tutorial/indexes/dictionary004.svg | 0 .../img/tutorial/indexes/dictionary005.drawio | 0 .../img/tutorial/indexes/dictionary005.svg | 0 .../img/tutorial/indexes/dictionary006.drawio | 0 .../img/tutorial/indexes/dictionary006.svg | 0 .../img/tutorial/indexes/dictionary007.drawio | 0 .../img/tutorial/indexes/dictionary007.svg | 0 .../img/tutorial/indexes/dictionary008.drawio | 0 .../img/tutorial/indexes/dictionary008.svg | 0 .../img/tutorial/indexes/techbook001.drawio | 0 .../img/tutorial/indexes/techbook001.svg | 0 .../docs}/img/tutorial/insert/image01.png | Bin .../docs}/img/tutorial/insert/image02.png | Bin .../docs}/img/tutorial/insert/image03.png | Bin .../tutorial/many-to-many/many-to-many.drawio | 0 .../tutorial/many-to-many/many-to-many.svg | 0 .../tutorial/offset-and-limit/db-browser.png | Bin .../tutorial/offset-and-limit/limit.drawio | 0 .../img/tutorial/offset-and-limit/limit.svg | 0 .../tutorial/offset-and-limit/limit2.drawio | 0 .../img/tutorial/offset-and-limit/limit2.svg | 0 .../tutorial/offset-and-limit/limit3.drawio | 0 .../img/tutorial/offset-and-limit/limit3.svg | 0 .../attributes/back-populates.drawio | 0 .../attributes/back-populates.svg | 0 .../attributes/back-populates2.drawio | 0 .../attributes/back-populates2.svg | 0 .../tutorial/relationships/select/image01.png | Bin .../tutorial/relationships/select/image02.png | Bin .../tutorial/relationships/select/image03.png | Bin .../select/relationships2.drawio | 0 .../relationships/select/relationships2.svg | 0 .../docs}/img/tutorial/select/image01.png | Bin .../docs}/img/tutorial/update/image01.png | Bin .../docs}/img/tutorial/where/image01.png | Bin docs/{ => en/docs}/index.md | 0 docs/{ => en/docs}/js/custom.js | 0 docs/{ => en/docs}/js/termynal.js | 0 docs/{ => en/docs}/release-notes.md | 0 .../tutorial/automatic-id-none-refresh.md | 36 +- docs/{ => en/docs}/tutorial/code-structure.md | 12 +- .../tutorial/connect/create-connected-rows.md | 22 +- .../connect/create-connected-tables.md | 16 +- docs/{ => en/docs}/tutorial/connect/index.md | 0 .../tutorial/connect/read-connected-data.md | 30 +- .../connect/remove-data-connections.md | 8 +- .../connect/update-data-connections.md | 8 +- .../create-db-and-table-with-db-browser.md | 0 .../docs}/tutorial/create-db-and-table.md | 42 +- docs/{ => en/docs}/tutorial/delete.md | 34 +- docs/{ => en/docs}/tutorial/fastapi/delete.md | 4 +- docs/{ => en/docs}/tutorial/fastapi/index.md | 0 .../tutorial/fastapi/limit-and-offset.md | 6 +- .../docs}/tutorial/fastapi/multiple-models.md | 34 +- .../docs}/tutorial/fastapi/read-one.md | 18 +- .../docs}/tutorial/fastapi/relationships.md | 26 +- .../docs}/tutorial/fastapi/response-model.md | 10 +- .../fastapi/session-with-dependency.md | 40 +- .../docs}/tutorial/fastapi/simple-hero-api.md | 26 +- docs/{ => en/docs}/tutorial/fastapi/teams.md | 16 +- docs/{ => en/docs}/tutorial/fastapi/tests.md | 46 +- docs/{ => en/docs}/tutorial/fastapi/update.md | 20 +- docs/{ => en/docs}/tutorial/index.md | 0 docs/{ => en/docs}/tutorial/indexes.md | 18 +- docs/{ => en/docs}/tutorial/insert.md | 46 +- .../docs}/tutorial/limit-and-offset.md | 24 +- .../tutorial/many-to-many/create-data.md | 14 +- .../many-to-many/create-models-with-link.md | 22 +- .../docs}/tutorial/many-to-many/index.md | 0 .../many-to-many/link-with-extra-fields.md | 26 +- .../update-remove-relationships.md | 20 +- docs/{ => en/docs}/tutorial/one.md | 42 +- .../relationship-attributes/back-populates.md | 50 +- .../create-and-update-relationships.md | 26 +- .../define-relationships-attributes.md | 12 +- .../tutorial/relationship-attributes/index.md | 0 .../read-relationships.md | 20 +- .../remove-relationships.md | 8 +- .../type-annotation-strings.md | 4 +- docs/{ => en/docs}/tutorial/select.md | 40 +- docs/{ => en/docs}/tutorial/update.md | 40 +- docs/{ => en/docs}/tutorial/where.md | 62 +-- docs/en/mkdocs.yml | 139 ++++++ docs/{ => en}/overrides/main.html | 0 docs/missing-translation.md | 4 + mkdocs.yml | 134 ------ pyproject.toml | 2 + scripts/docs.py | 452 ++++++++++++++++++ 161 files changed, 1068 insertions(+), 605 deletions(-) create mode 100644 docs/en/data/external_links.yml create mode 100644 docs/en/data/github_sponsors.yml create mode 100644 docs/en/data/people.yml create mode 100644 docs/en/data/sponsors.yml create mode 100644 docs/en/data/sponsors_badge.yml rename docs/{ => en/docs}/advanced/decimal.md (94%) rename docs/{ => en/docs}/advanced/index.md (100%) rename docs/{ => en/docs}/alternatives.md (100%) rename docs/{ => en/docs}/contributing.md (98%) rename docs/{ => en/docs}/css/custom.css (100%) rename docs/{ => en/docs}/css/termynal.css (100%) rename docs/{ => en/docs}/databases.md (100%) rename docs/{ => en/docs}/db-to-code.md (100%) rename docs/{ => en/docs}/features.md (100%) rename docs/{ => en/docs}/help.md (100%) rename docs/{ => en/docs}/img/create-db-and-table-with-db-browser/image001.png (100%) rename docs/{ => en/docs}/img/create-db-and-table-with-db-browser/image002.png (100%) rename docs/{ => en/docs}/img/create-db-and-table-with-db-browser/image003.png (100%) rename docs/{ => en/docs}/img/create-db-and-table-with-db-browser/image004.png (100%) rename docs/{ => en/docs}/img/create-db-and-table-with-db-browser/image005.png (100%) rename docs/{ => en/docs}/img/create-db-and-table-with-db-browser/image006.png (100%) rename docs/{ => en/docs}/img/create-db-and-table-with-db-browser/image007.png (100%) rename docs/{ => en/docs}/img/create-db-and-table-with-db-browser/image008.png (100%) rename docs/{ => en/docs}/img/create-db-and-table-with-db-browser/image009.png (100%) rename docs/{ => en/docs}/img/create-db-and-table-with-db-browser/image010.png (100%) rename docs/{ => en/docs}/img/create-db-and-table/inline-errors01.png (100%) rename docs/{ => en/docs}/img/databases/external-server.drawio (100%) rename docs/{ => en/docs}/img/databases/external-server.svg (100%) rename docs/{ => en/docs}/img/databases/multiple-servers.drawio (100%) rename docs/{ => en/docs}/img/databases/multiple-servers.svg (100%) rename docs/{ => en/docs}/img/databases/relationships.drawio (100%) rename docs/{ => en/docs}/img/databases/relationships.svg (100%) rename docs/{ => en/docs}/img/databases/same-server.drawio (100%) rename docs/{ => en/docs}/img/databases/same-server.svg (100%) rename docs/{ => en/docs}/img/databases/single-file.drawio (100%) rename docs/{ => en/docs}/img/databases/single-file.svg (100%) rename docs/{ => en/docs}/img/db-to-code/autocompletion01.png (100%) rename docs/{ => en/docs}/img/db-to-code/mapper.drawio (100%) rename docs/{ => en/docs}/img/db-to-code/mapper.svg (100%) rename docs/{ => en/docs}/img/favicon.png (100%) rename docs/{ => en/docs}/img/features/autocompletion01.png (100%) rename docs/{ => en/docs}/img/github-social-preview.png (100%) rename docs/{ => en/docs}/img/github-social-preview.svg (100%) rename docs/{ => en/docs}/img/icon-white.svg (100%) rename docs/{ => en/docs}/img/icon.svg (100%) rename docs/{ => en/docs}/img/index/autocompletion01.png (100%) rename docs/{ => en/docs}/img/index/autocompletion02.png (100%) rename docs/{ => en/docs}/img/index/inline-errors01.png (100%) rename docs/{ => en/docs}/img/logo-margin/logo-margin-vector.svg (100%) rename docs/{ => en/docs}/img/logo-margin/logo-margin.svg (100%) rename docs/{ => en/docs}/img/tutorial/delete/image01.png (100%) rename docs/{ => en/docs}/img/tutorial/fastapi/limit-and-offset/image01.png (100%) rename docs/{ => en/docs}/img/tutorial/fastapi/multiple-models/image01.png (100%) rename docs/{ => en/docs}/img/tutorial/fastapi/multiple-models/image02.png (100%) rename docs/{ => en/docs}/img/tutorial/fastapi/multiple-models/image03.png (100%) rename docs/{ => en/docs}/img/tutorial/fastapi/read-one/image01.png (100%) rename docs/{ => en/docs}/img/tutorial/fastapi/relationships/image01.png (100%) rename docs/{ => en/docs}/img/tutorial/fastapi/relationships/image02.png (100%) rename docs/{ => en/docs}/img/tutorial/fastapi/relationships/image03.png (100%) rename docs/{ => en/docs}/img/tutorial/fastapi/relationships/image04.png (100%) rename docs/{ => en/docs}/img/tutorial/fastapi/response-model/image01.png (100%) rename docs/{ => en/docs}/img/tutorial/fastapi/response-model/image02.png (100%) rename docs/{ => en/docs}/img/tutorial/fastapi/simple-hero-api/db-browser-01.png (100%) rename docs/{ => en/docs}/img/tutorial/fastapi/simple-hero-api/image01.png (100%) rename docs/{ => en/docs}/img/tutorial/fastapi/simple-hero-api/image02.png (100%) rename docs/{ => en/docs}/img/tutorial/fastapi/teams/image01.png (100%) rename docs/{ => en/docs}/img/tutorial/indexes/dictionary001.drawio (100%) rename docs/{ => en/docs}/img/tutorial/indexes/dictionary001.svg (100%) rename docs/{ => en/docs}/img/tutorial/indexes/dictionary002.drawio (100%) rename docs/{ => en/docs}/img/tutorial/indexes/dictionary002.svg (100%) rename docs/{ => en/docs}/img/tutorial/indexes/dictionary003.drawio (100%) rename docs/{ => en/docs}/img/tutorial/indexes/dictionary003.svg (100%) rename docs/{ => en/docs}/img/tutorial/indexes/dictionary004.drawio (100%) rename docs/{ => en/docs}/img/tutorial/indexes/dictionary004.svg (100%) rename docs/{ => en/docs}/img/tutorial/indexes/dictionary005.drawio (100%) rename docs/{ => en/docs}/img/tutorial/indexes/dictionary005.svg (100%) rename docs/{ => en/docs}/img/tutorial/indexes/dictionary006.drawio (100%) rename docs/{ => en/docs}/img/tutorial/indexes/dictionary006.svg (100%) rename docs/{ => en/docs}/img/tutorial/indexes/dictionary007.drawio (100%) rename docs/{ => en/docs}/img/tutorial/indexes/dictionary007.svg (100%) rename docs/{ => en/docs}/img/tutorial/indexes/dictionary008.drawio (100%) rename docs/{ => en/docs}/img/tutorial/indexes/dictionary008.svg (100%) rename docs/{ => en/docs}/img/tutorial/indexes/techbook001.drawio (100%) rename docs/{ => en/docs}/img/tutorial/indexes/techbook001.svg (100%) rename docs/{ => en/docs}/img/tutorial/insert/image01.png (100%) rename docs/{ => en/docs}/img/tutorial/insert/image02.png (100%) rename docs/{ => en/docs}/img/tutorial/insert/image03.png (100%) rename docs/{ => en/docs}/img/tutorial/many-to-many/many-to-many.drawio (100%) rename docs/{ => en/docs}/img/tutorial/many-to-many/many-to-many.svg (100%) rename docs/{ => en/docs}/img/tutorial/offset-and-limit/db-browser.png (100%) rename docs/{ => en/docs}/img/tutorial/offset-and-limit/limit.drawio (100%) rename docs/{ => en/docs}/img/tutorial/offset-and-limit/limit.svg (100%) rename docs/{ => en/docs}/img/tutorial/offset-and-limit/limit2.drawio (100%) rename docs/{ => en/docs}/img/tutorial/offset-and-limit/limit2.svg (100%) rename docs/{ => en/docs}/img/tutorial/offset-and-limit/limit3.drawio (100%) rename docs/{ => en/docs}/img/tutorial/offset-and-limit/limit3.svg (100%) rename docs/{ => en/docs}/img/tutorial/relationships/attributes/back-populates.drawio (100%) rename docs/{ => en/docs}/img/tutorial/relationships/attributes/back-populates.svg (100%) rename docs/{ => en/docs}/img/tutorial/relationships/attributes/back-populates2.drawio (100%) rename docs/{ => en/docs}/img/tutorial/relationships/attributes/back-populates2.svg (100%) rename docs/{ => en/docs}/img/tutorial/relationships/select/image01.png (100%) rename docs/{ => en/docs}/img/tutorial/relationships/select/image02.png (100%) rename docs/{ => en/docs}/img/tutorial/relationships/select/image03.png (100%) rename docs/{ => en/docs}/img/tutorial/relationships/select/relationships2.drawio (100%) rename docs/{ => en/docs}/img/tutorial/relationships/select/relationships2.svg (100%) rename docs/{ => en/docs}/img/tutorial/select/image01.png (100%) rename docs/{ => en/docs}/img/tutorial/update/image01.png (100%) rename docs/{ => en/docs}/img/tutorial/where/image01.png (100%) rename docs/{ => en/docs}/index.md (100%) rename docs/{ => en/docs}/js/custom.js (100%) rename docs/{ => en/docs}/js/termynal.js (100%) rename docs/{ => en/docs}/release-notes.md (100%) rename docs/{ => en/docs}/tutorial/automatic-id-none-refresh.md (92%) rename docs/{ => en/docs}/tutorial/code-structure.md (95%) rename docs/{ => en/docs}/tutorial/connect/create-connected-rows.md (91%) rename docs/{ => en/docs}/tutorial/connect/create-connected-tables.md (92%) rename docs/{ => en/docs}/tutorial/connect/index.md (100%) rename docs/{ => en/docs}/tutorial/connect/read-connected-data.md (94%) rename docs/{ => en/docs}/tutorial/connect/remove-data-connections.md (90%) rename docs/{ => en/docs}/tutorial/connect/update-data-connections.md (90%) rename docs/{ => en/docs}/tutorial/create-db-and-table-with-db-browser.md (100%) rename docs/{ => en/docs}/tutorial/create-db-and-table.md (93%) rename docs/{ => en/docs}/tutorial/delete.md (88%) rename docs/{ => en/docs}/tutorial/fastapi/delete.md (88%) rename docs/{ => en/docs}/tutorial/fastapi/index.md (100%) rename docs/{ => en/docs}/tutorial/fastapi/limit-and-offset.md (91%) rename docs/{ => en/docs}/tutorial/fastapi/multiple-models.md (93%) rename docs/{ => en/docs}/tutorial/fastapi/read-one.md (78%) rename docs/{ => en/docs}/tutorial/fastapi/relationships.md (92%) rename docs/{ => en/docs}/tutorial/fastapi/response-model.md (92%) rename docs/{ => en/docs}/tutorial/fastapi/session-with-dependency.md (77%) rename docs/{ => en/docs}/tutorial/fastapi/simple-hero-api.md (91%) rename docs/{ => en/docs}/tutorial/fastapi/teams.md (86%) rename docs/{ => en/docs}/tutorial/fastapi/tests.md (88%) rename docs/{ => en/docs}/tutorial/fastapi/update.md (90%) rename docs/{ => en/docs}/tutorial/index.md (100%) rename docs/{ => en/docs}/tutorial/indexes.md (97%) rename docs/{ => en/docs}/tutorial/insert.md (90%) rename docs/{ => en/docs}/tutorial/limit-and-offset.md (90%) rename docs/{ => en/docs}/tutorial/many-to-many/create-data.md (92%) rename docs/{ => en/docs}/tutorial/many-to-many/create-models-with-link.md (86%) rename docs/{ => en/docs}/tutorial/many-to-many/index.md (100%) rename docs/{ => en/docs}/tutorial/many-to-many/link-with-extra-fields.md (94%) rename docs/{ => en/docs}/tutorial/many-to-many/update-remove-relationships.md (92%) rename docs/{ => en/docs}/tutorial/one.md (88%) rename docs/{ => en/docs}/tutorial/relationship-attributes/back-populates.md (81%) rename docs/{ => en/docs}/tutorial/relationship-attributes/create-and-update-relationships.md (79%) rename docs/{ => en/docs}/tutorial/relationship-attributes/define-relationships-attributes.md (87%) rename docs/{ => en/docs}/tutorial/relationship-attributes/index.md (100%) rename docs/{ => en/docs}/tutorial/relationship-attributes/read-relationships.md (77%) rename docs/{ => en/docs}/tutorial/relationship-attributes/remove-relationships.md (73%) rename docs/{ => en/docs}/tutorial/relationship-attributes/type-annotation-strings.md (85%) rename docs/{ => en/docs}/tutorial/select.md (92%) rename docs/{ => en/docs}/tutorial/update.md (87%) rename docs/{ => en/docs}/tutorial/where.md (93%) create mode 100644 docs/en/mkdocs.yml rename docs/{ => en}/overrides/main.html (100%) create mode 100644 docs/missing-translation.md delete mode 100644 mkdocs.yml create mode 100644 scripts/docs.py diff --git a/docs/en/data/external_links.yml b/docs/en/data/external_links.yml new file mode 100644 index 0000000000..e69de29bb2 diff --git a/docs/en/data/github_sponsors.yml b/docs/en/data/github_sponsors.yml new file mode 100644 index 0000000000..e69de29bb2 diff --git a/docs/en/data/people.yml b/docs/en/data/people.yml new file mode 100644 index 0000000000..e69de29bb2 diff --git a/docs/en/data/sponsors.yml b/docs/en/data/sponsors.yml new file mode 100644 index 0000000000..e69de29bb2 diff --git a/docs/en/data/sponsors_badge.yml b/docs/en/data/sponsors_badge.yml new file mode 100644 index 0000000000..e69de29bb2 diff --git a/docs/advanced/decimal.md b/docs/en/docs/advanced/decimal.md similarity index 94% rename from docs/advanced/decimal.md rename to docs/en/docs/advanced/decimal.md index c0541b75df..231c1b2201 100644 --- a/docs/advanced/decimal.md +++ b/docs/en/docs/advanced/decimal.md @@ -36,7 +36,7 @@ When you use `condecimal()` you can specify the number of digits and decimal pla Let's say that each hero in the database will have an amount of money. We could make that field a `Decimal` type using the `condecimal()` function: ```{.python .annotate hl_lines="12" } -{!./docs_src/advanced/decimal/tutorial001.py[ln:1-12]!} +{!../../docs_src/advanced/decimal/tutorial001.py[ln:1-12]!} # More code here later 👇 ``` @@ -45,7 +45,7 @@ Let's say that each hero in the database will have an amount of money. We could 👀 Full file preview ```Python -{!./docs_src/advanced/decimal/tutorial001.py!} +{!../../docs_src/advanced/decimal/tutorial001.py!} ``` @@ -82,7 +82,7 @@ When creating new models you can actually pass normal (`float`) numbers, Pydanti ```Python hl_lines="4-6" # Code above omitted 👆 -{!./docs_src/advanced/decimal/tutorial001.py[ln:25-35]!} +{!../../docs_src/advanced/decimal/tutorial001.py[ln:25-35]!} # Code below omitted 👇 ``` @@ -91,7 +91,7 @@ When creating new models you can actually pass normal (`float`) numbers, Pydanti 👀 Full file preview ```Python -{!./docs_src/advanced/decimal/tutorial001.py!} +{!../../docs_src/advanced/decimal/tutorial001.py!} ``` @@ -103,7 +103,7 @@ Then, when working with Decimal types, you can confirm that they indeed avoid th ```Python hl_lines="15-16" # Code above omitted 👆 -{!./docs_src/advanced/decimal/tutorial001.py[ln:38-51]!} +{!../../docs_src/advanced/decimal/tutorial001.py[ln:38-51]!} # Code below omitted 👇 ``` @@ -112,7 +112,7 @@ Then, when working with Decimal types, you can confirm that they indeed avoid th 👀 Full file preview ```Python -{!./docs_src/advanced/decimal/tutorial001.py!} +{!../../docs_src/advanced/decimal/tutorial001.py!} ``` diff --git a/docs/advanced/index.md b/docs/en/docs/advanced/index.md similarity index 100% rename from docs/advanced/index.md rename to docs/en/docs/advanced/index.md diff --git a/docs/alternatives.md b/docs/en/docs/alternatives.md similarity index 100% rename from docs/alternatives.md rename to docs/en/docs/alternatives.md diff --git a/docs/contributing.md b/docs/en/docs/contributing.md similarity index 98% rename from docs/contributing.md rename to docs/en/docs/contributing.md index f2964fba9b..4e8b44120c 100644 --- a/docs/contributing.md +++ b/docs/en/docs/contributing.md @@ -76,7 +76,7 @@ Many of the tutorials have blocks of code. In most of the cases, these blocks of code are actual complete applications that can be run as is. -In fact, those blocks of code are not written inside the Markdown, they are Python files in the `./docs_src/` directory. +In fact, those blocks of code are not written inside the Markdown, they are Python files in the `../../docs_src/` directory. And those Python files are included/injected in the documentation when generating the site. diff --git a/docs/css/custom.css b/docs/en/docs/css/custom.css similarity index 100% rename from docs/css/custom.css rename to docs/en/docs/css/custom.css diff --git a/docs/css/termynal.css b/docs/en/docs/css/termynal.css similarity index 100% rename from docs/css/termynal.css rename to docs/en/docs/css/termynal.css diff --git a/docs/databases.md b/docs/en/docs/databases.md similarity index 100% rename from docs/databases.md rename to docs/en/docs/databases.md diff --git a/docs/db-to-code.md b/docs/en/docs/db-to-code.md similarity index 100% rename from docs/db-to-code.md rename to docs/en/docs/db-to-code.md diff --git a/docs/features.md b/docs/en/docs/features.md similarity index 100% rename from docs/features.md rename to docs/en/docs/features.md diff --git a/docs/help.md b/docs/en/docs/help.md similarity index 100% rename from docs/help.md rename to docs/en/docs/help.md diff --git a/docs/img/create-db-and-table-with-db-browser/image001.png b/docs/en/docs/img/create-db-and-table-with-db-browser/image001.png similarity index 100% rename from docs/img/create-db-and-table-with-db-browser/image001.png rename to docs/en/docs/img/create-db-and-table-with-db-browser/image001.png diff --git a/docs/img/create-db-and-table-with-db-browser/image002.png b/docs/en/docs/img/create-db-and-table-with-db-browser/image002.png similarity index 100% rename from docs/img/create-db-and-table-with-db-browser/image002.png rename to docs/en/docs/img/create-db-and-table-with-db-browser/image002.png diff --git a/docs/img/create-db-and-table-with-db-browser/image003.png b/docs/en/docs/img/create-db-and-table-with-db-browser/image003.png similarity index 100% rename from docs/img/create-db-and-table-with-db-browser/image003.png rename to docs/en/docs/img/create-db-and-table-with-db-browser/image003.png diff --git a/docs/img/create-db-and-table-with-db-browser/image004.png b/docs/en/docs/img/create-db-and-table-with-db-browser/image004.png similarity index 100% rename from docs/img/create-db-and-table-with-db-browser/image004.png rename to docs/en/docs/img/create-db-and-table-with-db-browser/image004.png diff --git a/docs/img/create-db-and-table-with-db-browser/image005.png b/docs/en/docs/img/create-db-and-table-with-db-browser/image005.png similarity index 100% rename from docs/img/create-db-and-table-with-db-browser/image005.png rename to docs/en/docs/img/create-db-and-table-with-db-browser/image005.png diff --git a/docs/img/create-db-and-table-with-db-browser/image006.png b/docs/en/docs/img/create-db-and-table-with-db-browser/image006.png similarity index 100% rename from docs/img/create-db-and-table-with-db-browser/image006.png rename to docs/en/docs/img/create-db-and-table-with-db-browser/image006.png diff --git a/docs/img/create-db-and-table-with-db-browser/image007.png b/docs/en/docs/img/create-db-and-table-with-db-browser/image007.png similarity index 100% rename from docs/img/create-db-and-table-with-db-browser/image007.png rename to docs/en/docs/img/create-db-and-table-with-db-browser/image007.png diff --git a/docs/img/create-db-and-table-with-db-browser/image008.png b/docs/en/docs/img/create-db-and-table-with-db-browser/image008.png similarity index 100% rename from docs/img/create-db-and-table-with-db-browser/image008.png rename to docs/en/docs/img/create-db-and-table-with-db-browser/image008.png diff --git a/docs/img/create-db-and-table-with-db-browser/image009.png b/docs/en/docs/img/create-db-and-table-with-db-browser/image009.png similarity index 100% rename from docs/img/create-db-and-table-with-db-browser/image009.png rename to docs/en/docs/img/create-db-and-table-with-db-browser/image009.png diff --git a/docs/img/create-db-and-table-with-db-browser/image010.png b/docs/en/docs/img/create-db-and-table-with-db-browser/image010.png similarity index 100% rename from docs/img/create-db-and-table-with-db-browser/image010.png rename to docs/en/docs/img/create-db-and-table-with-db-browser/image010.png diff --git a/docs/img/create-db-and-table/inline-errors01.png b/docs/en/docs/img/create-db-and-table/inline-errors01.png similarity index 100% rename from docs/img/create-db-and-table/inline-errors01.png rename to docs/en/docs/img/create-db-and-table/inline-errors01.png diff --git a/docs/img/databases/external-server.drawio b/docs/en/docs/img/databases/external-server.drawio similarity index 100% rename from docs/img/databases/external-server.drawio rename to docs/en/docs/img/databases/external-server.drawio diff --git a/docs/img/databases/external-server.svg b/docs/en/docs/img/databases/external-server.svg similarity index 100% rename from docs/img/databases/external-server.svg rename to docs/en/docs/img/databases/external-server.svg diff --git a/docs/img/databases/multiple-servers.drawio b/docs/en/docs/img/databases/multiple-servers.drawio similarity index 100% rename from docs/img/databases/multiple-servers.drawio rename to docs/en/docs/img/databases/multiple-servers.drawio diff --git a/docs/img/databases/multiple-servers.svg b/docs/en/docs/img/databases/multiple-servers.svg similarity index 100% rename from docs/img/databases/multiple-servers.svg rename to docs/en/docs/img/databases/multiple-servers.svg diff --git a/docs/img/databases/relationships.drawio b/docs/en/docs/img/databases/relationships.drawio similarity index 100% rename from docs/img/databases/relationships.drawio rename to docs/en/docs/img/databases/relationships.drawio diff --git a/docs/img/databases/relationships.svg b/docs/en/docs/img/databases/relationships.svg similarity index 100% rename from docs/img/databases/relationships.svg rename to docs/en/docs/img/databases/relationships.svg diff --git a/docs/img/databases/same-server.drawio b/docs/en/docs/img/databases/same-server.drawio similarity index 100% rename from docs/img/databases/same-server.drawio rename to docs/en/docs/img/databases/same-server.drawio diff --git a/docs/img/databases/same-server.svg b/docs/en/docs/img/databases/same-server.svg similarity index 100% rename from docs/img/databases/same-server.svg rename to docs/en/docs/img/databases/same-server.svg diff --git a/docs/img/databases/single-file.drawio b/docs/en/docs/img/databases/single-file.drawio similarity index 100% rename from docs/img/databases/single-file.drawio rename to docs/en/docs/img/databases/single-file.drawio diff --git a/docs/img/databases/single-file.svg b/docs/en/docs/img/databases/single-file.svg similarity index 100% rename from docs/img/databases/single-file.svg rename to docs/en/docs/img/databases/single-file.svg diff --git a/docs/img/db-to-code/autocompletion01.png b/docs/en/docs/img/db-to-code/autocompletion01.png similarity index 100% rename from docs/img/db-to-code/autocompletion01.png rename to docs/en/docs/img/db-to-code/autocompletion01.png diff --git a/docs/img/db-to-code/mapper.drawio b/docs/en/docs/img/db-to-code/mapper.drawio similarity index 100% rename from docs/img/db-to-code/mapper.drawio rename to docs/en/docs/img/db-to-code/mapper.drawio diff --git a/docs/img/db-to-code/mapper.svg b/docs/en/docs/img/db-to-code/mapper.svg similarity index 100% rename from docs/img/db-to-code/mapper.svg rename to docs/en/docs/img/db-to-code/mapper.svg diff --git a/docs/img/favicon.png b/docs/en/docs/img/favicon.png similarity index 100% rename from docs/img/favicon.png rename to docs/en/docs/img/favicon.png diff --git a/docs/img/features/autocompletion01.png b/docs/en/docs/img/features/autocompletion01.png similarity index 100% rename from docs/img/features/autocompletion01.png rename to docs/en/docs/img/features/autocompletion01.png diff --git a/docs/img/github-social-preview.png b/docs/en/docs/img/github-social-preview.png similarity index 100% rename from docs/img/github-social-preview.png rename to docs/en/docs/img/github-social-preview.png diff --git a/docs/img/github-social-preview.svg b/docs/en/docs/img/github-social-preview.svg similarity index 100% rename from docs/img/github-social-preview.svg rename to docs/en/docs/img/github-social-preview.svg diff --git a/docs/img/icon-white.svg b/docs/en/docs/img/icon-white.svg similarity index 100% rename from docs/img/icon-white.svg rename to docs/en/docs/img/icon-white.svg diff --git a/docs/img/icon.svg b/docs/en/docs/img/icon.svg similarity index 100% rename from docs/img/icon.svg rename to docs/en/docs/img/icon.svg diff --git a/docs/img/index/autocompletion01.png b/docs/en/docs/img/index/autocompletion01.png similarity index 100% rename from docs/img/index/autocompletion01.png rename to docs/en/docs/img/index/autocompletion01.png diff --git a/docs/img/index/autocompletion02.png b/docs/en/docs/img/index/autocompletion02.png similarity index 100% rename from docs/img/index/autocompletion02.png rename to docs/en/docs/img/index/autocompletion02.png diff --git a/docs/img/index/inline-errors01.png b/docs/en/docs/img/index/inline-errors01.png similarity index 100% rename from docs/img/index/inline-errors01.png rename to docs/en/docs/img/index/inline-errors01.png diff --git a/docs/img/logo-margin/logo-margin-vector.svg b/docs/en/docs/img/logo-margin/logo-margin-vector.svg similarity index 100% rename from docs/img/logo-margin/logo-margin-vector.svg rename to docs/en/docs/img/logo-margin/logo-margin-vector.svg diff --git a/docs/img/logo-margin/logo-margin.svg b/docs/en/docs/img/logo-margin/logo-margin.svg similarity index 100% rename from docs/img/logo-margin/logo-margin.svg rename to docs/en/docs/img/logo-margin/logo-margin.svg diff --git a/docs/img/tutorial/delete/image01.png b/docs/en/docs/img/tutorial/delete/image01.png similarity index 100% rename from docs/img/tutorial/delete/image01.png rename to docs/en/docs/img/tutorial/delete/image01.png diff --git a/docs/img/tutorial/fastapi/limit-and-offset/image01.png b/docs/en/docs/img/tutorial/fastapi/limit-and-offset/image01.png similarity index 100% rename from docs/img/tutorial/fastapi/limit-and-offset/image01.png rename to docs/en/docs/img/tutorial/fastapi/limit-and-offset/image01.png diff --git a/docs/img/tutorial/fastapi/multiple-models/image01.png b/docs/en/docs/img/tutorial/fastapi/multiple-models/image01.png similarity index 100% rename from docs/img/tutorial/fastapi/multiple-models/image01.png rename to docs/en/docs/img/tutorial/fastapi/multiple-models/image01.png diff --git a/docs/img/tutorial/fastapi/multiple-models/image02.png b/docs/en/docs/img/tutorial/fastapi/multiple-models/image02.png similarity index 100% rename from docs/img/tutorial/fastapi/multiple-models/image02.png rename to docs/en/docs/img/tutorial/fastapi/multiple-models/image02.png diff --git a/docs/img/tutorial/fastapi/multiple-models/image03.png b/docs/en/docs/img/tutorial/fastapi/multiple-models/image03.png similarity index 100% rename from docs/img/tutorial/fastapi/multiple-models/image03.png rename to docs/en/docs/img/tutorial/fastapi/multiple-models/image03.png diff --git a/docs/img/tutorial/fastapi/read-one/image01.png b/docs/en/docs/img/tutorial/fastapi/read-one/image01.png similarity index 100% rename from docs/img/tutorial/fastapi/read-one/image01.png rename to docs/en/docs/img/tutorial/fastapi/read-one/image01.png diff --git a/docs/img/tutorial/fastapi/relationships/image01.png b/docs/en/docs/img/tutorial/fastapi/relationships/image01.png similarity index 100% rename from docs/img/tutorial/fastapi/relationships/image01.png rename to docs/en/docs/img/tutorial/fastapi/relationships/image01.png diff --git a/docs/img/tutorial/fastapi/relationships/image02.png b/docs/en/docs/img/tutorial/fastapi/relationships/image02.png similarity index 100% rename from docs/img/tutorial/fastapi/relationships/image02.png rename to docs/en/docs/img/tutorial/fastapi/relationships/image02.png diff --git a/docs/img/tutorial/fastapi/relationships/image03.png b/docs/en/docs/img/tutorial/fastapi/relationships/image03.png similarity index 100% rename from docs/img/tutorial/fastapi/relationships/image03.png rename to docs/en/docs/img/tutorial/fastapi/relationships/image03.png diff --git a/docs/img/tutorial/fastapi/relationships/image04.png b/docs/en/docs/img/tutorial/fastapi/relationships/image04.png similarity index 100% rename from docs/img/tutorial/fastapi/relationships/image04.png rename to docs/en/docs/img/tutorial/fastapi/relationships/image04.png diff --git a/docs/img/tutorial/fastapi/response-model/image01.png b/docs/en/docs/img/tutorial/fastapi/response-model/image01.png similarity index 100% rename from docs/img/tutorial/fastapi/response-model/image01.png rename to docs/en/docs/img/tutorial/fastapi/response-model/image01.png diff --git a/docs/img/tutorial/fastapi/response-model/image02.png b/docs/en/docs/img/tutorial/fastapi/response-model/image02.png similarity index 100% rename from docs/img/tutorial/fastapi/response-model/image02.png rename to docs/en/docs/img/tutorial/fastapi/response-model/image02.png diff --git a/docs/img/tutorial/fastapi/simple-hero-api/db-browser-01.png b/docs/en/docs/img/tutorial/fastapi/simple-hero-api/db-browser-01.png similarity index 100% rename from docs/img/tutorial/fastapi/simple-hero-api/db-browser-01.png rename to docs/en/docs/img/tutorial/fastapi/simple-hero-api/db-browser-01.png diff --git a/docs/img/tutorial/fastapi/simple-hero-api/image01.png b/docs/en/docs/img/tutorial/fastapi/simple-hero-api/image01.png similarity index 100% rename from docs/img/tutorial/fastapi/simple-hero-api/image01.png rename to docs/en/docs/img/tutorial/fastapi/simple-hero-api/image01.png diff --git a/docs/img/tutorial/fastapi/simple-hero-api/image02.png b/docs/en/docs/img/tutorial/fastapi/simple-hero-api/image02.png similarity index 100% rename from docs/img/tutorial/fastapi/simple-hero-api/image02.png rename to docs/en/docs/img/tutorial/fastapi/simple-hero-api/image02.png diff --git a/docs/img/tutorial/fastapi/teams/image01.png b/docs/en/docs/img/tutorial/fastapi/teams/image01.png similarity index 100% rename from docs/img/tutorial/fastapi/teams/image01.png rename to docs/en/docs/img/tutorial/fastapi/teams/image01.png diff --git a/docs/img/tutorial/indexes/dictionary001.drawio b/docs/en/docs/img/tutorial/indexes/dictionary001.drawio similarity index 100% rename from docs/img/tutorial/indexes/dictionary001.drawio rename to docs/en/docs/img/tutorial/indexes/dictionary001.drawio diff --git a/docs/img/tutorial/indexes/dictionary001.svg b/docs/en/docs/img/tutorial/indexes/dictionary001.svg similarity index 100% rename from docs/img/tutorial/indexes/dictionary001.svg rename to docs/en/docs/img/tutorial/indexes/dictionary001.svg diff --git a/docs/img/tutorial/indexes/dictionary002.drawio b/docs/en/docs/img/tutorial/indexes/dictionary002.drawio similarity index 100% rename from docs/img/tutorial/indexes/dictionary002.drawio rename to docs/en/docs/img/tutorial/indexes/dictionary002.drawio diff --git a/docs/img/tutorial/indexes/dictionary002.svg b/docs/en/docs/img/tutorial/indexes/dictionary002.svg similarity index 100% rename from docs/img/tutorial/indexes/dictionary002.svg rename to docs/en/docs/img/tutorial/indexes/dictionary002.svg diff --git a/docs/img/tutorial/indexes/dictionary003.drawio b/docs/en/docs/img/tutorial/indexes/dictionary003.drawio similarity index 100% rename from docs/img/tutorial/indexes/dictionary003.drawio rename to docs/en/docs/img/tutorial/indexes/dictionary003.drawio diff --git a/docs/img/tutorial/indexes/dictionary003.svg b/docs/en/docs/img/tutorial/indexes/dictionary003.svg similarity index 100% rename from docs/img/tutorial/indexes/dictionary003.svg rename to docs/en/docs/img/tutorial/indexes/dictionary003.svg diff --git a/docs/img/tutorial/indexes/dictionary004.drawio b/docs/en/docs/img/tutorial/indexes/dictionary004.drawio similarity index 100% rename from docs/img/tutorial/indexes/dictionary004.drawio rename to docs/en/docs/img/tutorial/indexes/dictionary004.drawio diff --git a/docs/img/tutorial/indexes/dictionary004.svg b/docs/en/docs/img/tutorial/indexes/dictionary004.svg similarity index 100% rename from docs/img/tutorial/indexes/dictionary004.svg rename to docs/en/docs/img/tutorial/indexes/dictionary004.svg diff --git a/docs/img/tutorial/indexes/dictionary005.drawio b/docs/en/docs/img/tutorial/indexes/dictionary005.drawio similarity index 100% rename from docs/img/tutorial/indexes/dictionary005.drawio rename to docs/en/docs/img/tutorial/indexes/dictionary005.drawio diff --git a/docs/img/tutorial/indexes/dictionary005.svg b/docs/en/docs/img/tutorial/indexes/dictionary005.svg similarity index 100% rename from docs/img/tutorial/indexes/dictionary005.svg rename to docs/en/docs/img/tutorial/indexes/dictionary005.svg diff --git a/docs/img/tutorial/indexes/dictionary006.drawio b/docs/en/docs/img/tutorial/indexes/dictionary006.drawio similarity index 100% rename from docs/img/tutorial/indexes/dictionary006.drawio rename to docs/en/docs/img/tutorial/indexes/dictionary006.drawio diff --git a/docs/img/tutorial/indexes/dictionary006.svg b/docs/en/docs/img/tutorial/indexes/dictionary006.svg similarity index 100% rename from docs/img/tutorial/indexes/dictionary006.svg rename to docs/en/docs/img/tutorial/indexes/dictionary006.svg diff --git a/docs/img/tutorial/indexes/dictionary007.drawio b/docs/en/docs/img/tutorial/indexes/dictionary007.drawio similarity index 100% rename from docs/img/tutorial/indexes/dictionary007.drawio rename to docs/en/docs/img/tutorial/indexes/dictionary007.drawio diff --git a/docs/img/tutorial/indexes/dictionary007.svg b/docs/en/docs/img/tutorial/indexes/dictionary007.svg similarity index 100% rename from docs/img/tutorial/indexes/dictionary007.svg rename to docs/en/docs/img/tutorial/indexes/dictionary007.svg diff --git a/docs/img/tutorial/indexes/dictionary008.drawio b/docs/en/docs/img/tutorial/indexes/dictionary008.drawio similarity index 100% rename from docs/img/tutorial/indexes/dictionary008.drawio rename to docs/en/docs/img/tutorial/indexes/dictionary008.drawio diff --git a/docs/img/tutorial/indexes/dictionary008.svg b/docs/en/docs/img/tutorial/indexes/dictionary008.svg similarity index 100% rename from docs/img/tutorial/indexes/dictionary008.svg rename to docs/en/docs/img/tutorial/indexes/dictionary008.svg diff --git a/docs/img/tutorial/indexes/techbook001.drawio b/docs/en/docs/img/tutorial/indexes/techbook001.drawio similarity index 100% rename from docs/img/tutorial/indexes/techbook001.drawio rename to docs/en/docs/img/tutorial/indexes/techbook001.drawio diff --git a/docs/img/tutorial/indexes/techbook001.svg b/docs/en/docs/img/tutorial/indexes/techbook001.svg similarity index 100% rename from docs/img/tutorial/indexes/techbook001.svg rename to docs/en/docs/img/tutorial/indexes/techbook001.svg diff --git a/docs/img/tutorial/insert/image01.png b/docs/en/docs/img/tutorial/insert/image01.png similarity index 100% rename from docs/img/tutorial/insert/image01.png rename to docs/en/docs/img/tutorial/insert/image01.png diff --git a/docs/img/tutorial/insert/image02.png b/docs/en/docs/img/tutorial/insert/image02.png similarity index 100% rename from docs/img/tutorial/insert/image02.png rename to docs/en/docs/img/tutorial/insert/image02.png diff --git a/docs/img/tutorial/insert/image03.png b/docs/en/docs/img/tutorial/insert/image03.png similarity index 100% rename from docs/img/tutorial/insert/image03.png rename to docs/en/docs/img/tutorial/insert/image03.png diff --git a/docs/img/tutorial/many-to-many/many-to-many.drawio b/docs/en/docs/img/tutorial/many-to-many/many-to-many.drawio similarity index 100% rename from docs/img/tutorial/many-to-many/many-to-many.drawio rename to docs/en/docs/img/tutorial/many-to-many/many-to-many.drawio diff --git a/docs/img/tutorial/many-to-many/many-to-many.svg b/docs/en/docs/img/tutorial/many-to-many/many-to-many.svg similarity index 100% rename from docs/img/tutorial/many-to-many/many-to-many.svg rename to docs/en/docs/img/tutorial/many-to-many/many-to-many.svg diff --git a/docs/img/tutorial/offset-and-limit/db-browser.png b/docs/en/docs/img/tutorial/offset-and-limit/db-browser.png similarity index 100% rename from docs/img/tutorial/offset-and-limit/db-browser.png rename to docs/en/docs/img/tutorial/offset-and-limit/db-browser.png diff --git a/docs/img/tutorial/offset-and-limit/limit.drawio b/docs/en/docs/img/tutorial/offset-and-limit/limit.drawio similarity index 100% rename from docs/img/tutorial/offset-and-limit/limit.drawio rename to docs/en/docs/img/tutorial/offset-and-limit/limit.drawio diff --git a/docs/img/tutorial/offset-and-limit/limit.svg b/docs/en/docs/img/tutorial/offset-and-limit/limit.svg similarity index 100% rename from docs/img/tutorial/offset-and-limit/limit.svg rename to docs/en/docs/img/tutorial/offset-and-limit/limit.svg diff --git a/docs/img/tutorial/offset-and-limit/limit2.drawio b/docs/en/docs/img/tutorial/offset-and-limit/limit2.drawio similarity index 100% rename from docs/img/tutorial/offset-and-limit/limit2.drawio rename to docs/en/docs/img/tutorial/offset-and-limit/limit2.drawio diff --git a/docs/img/tutorial/offset-and-limit/limit2.svg b/docs/en/docs/img/tutorial/offset-and-limit/limit2.svg similarity index 100% rename from docs/img/tutorial/offset-and-limit/limit2.svg rename to docs/en/docs/img/tutorial/offset-and-limit/limit2.svg diff --git a/docs/img/tutorial/offset-and-limit/limit3.drawio b/docs/en/docs/img/tutorial/offset-and-limit/limit3.drawio similarity index 100% rename from docs/img/tutorial/offset-and-limit/limit3.drawio rename to docs/en/docs/img/tutorial/offset-and-limit/limit3.drawio diff --git a/docs/img/tutorial/offset-and-limit/limit3.svg b/docs/en/docs/img/tutorial/offset-and-limit/limit3.svg similarity index 100% rename from docs/img/tutorial/offset-and-limit/limit3.svg rename to docs/en/docs/img/tutorial/offset-and-limit/limit3.svg diff --git a/docs/img/tutorial/relationships/attributes/back-populates.drawio b/docs/en/docs/img/tutorial/relationships/attributes/back-populates.drawio similarity index 100% rename from docs/img/tutorial/relationships/attributes/back-populates.drawio rename to docs/en/docs/img/tutorial/relationships/attributes/back-populates.drawio diff --git a/docs/img/tutorial/relationships/attributes/back-populates.svg b/docs/en/docs/img/tutorial/relationships/attributes/back-populates.svg similarity index 100% rename from docs/img/tutorial/relationships/attributes/back-populates.svg rename to docs/en/docs/img/tutorial/relationships/attributes/back-populates.svg diff --git a/docs/img/tutorial/relationships/attributes/back-populates2.drawio b/docs/en/docs/img/tutorial/relationships/attributes/back-populates2.drawio similarity index 100% rename from docs/img/tutorial/relationships/attributes/back-populates2.drawio rename to docs/en/docs/img/tutorial/relationships/attributes/back-populates2.drawio diff --git a/docs/img/tutorial/relationships/attributes/back-populates2.svg b/docs/en/docs/img/tutorial/relationships/attributes/back-populates2.svg similarity index 100% rename from docs/img/tutorial/relationships/attributes/back-populates2.svg rename to docs/en/docs/img/tutorial/relationships/attributes/back-populates2.svg diff --git a/docs/img/tutorial/relationships/select/image01.png b/docs/en/docs/img/tutorial/relationships/select/image01.png similarity index 100% rename from docs/img/tutorial/relationships/select/image01.png rename to docs/en/docs/img/tutorial/relationships/select/image01.png diff --git a/docs/img/tutorial/relationships/select/image02.png b/docs/en/docs/img/tutorial/relationships/select/image02.png similarity index 100% rename from docs/img/tutorial/relationships/select/image02.png rename to docs/en/docs/img/tutorial/relationships/select/image02.png diff --git a/docs/img/tutorial/relationships/select/image03.png b/docs/en/docs/img/tutorial/relationships/select/image03.png similarity index 100% rename from docs/img/tutorial/relationships/select/image03.png rename to docs/en/docs/img/tutorial/relationships/select/image03.png diff --git a/docs/img/tutorial/relationships/select/relationships2.drawio b/docs/en/docs/img/tutorial/relationships/select/relationships2.drawio similarity index 100% rename from docs/img/tutorial/relationships/select/relationships2.drawio rename to docs/en/docs/img/tutorial/relationships/select/relationships2.drawio diff --git a/docs/img/tutorial/relationships/select/relationships2.svg b/docs/en/docs/img/tutorial/relationships/select/relationships2.svg similarity index 100% rename from docs/img/tutorial/relationships/select/relationships2.svg rename to docs/en/docs/img/tutorial/relationships/select/relationships2.svg diff --git a/docs/img/tutorial/select/image01.png b/docs/en/docs/img/tutorial/select/image01.png similarity index 100% rename from docs/img/tutorial/select/image01.png rename to docs/en/docs/img/tutorial/select/image01.png diff --git a/docs/img/tutorial/update/image01.png b/docs/en/docs/img/tutorial/update/image01.png similarity index 100% rename from docs/img/tutorial/update/image01.png rename to docs/en/docs/img/tutorial/update/image01.png diff --git a/docs/img/tutorial/where/image01.png b/docs/en/docs/img/tutorial/where/image01.png similarity index 100% rename from docs/img/tutorial/where/image01.png rename to docs/en/docs/img/tutorial/where/image01.png diff --git a/docs/index.md b/docs/en/docs/index.md similarity index 100% rename from docs/index.md rename to docs/en/docs/index.md diff --git a/docs/js/custom.js b/docs/en/docs/js/custom.js similarity index 100% rename from docs/js/custom.js rename to docs/en/docs/js/custom.js diff --git a/docs/js/termynal.js b/docs/en/docs/js/termynal.js similarity index 100% rename from docs/js/termynal.js rename to docs/en/docs/js/termynal.js diff --git a/docs/release-notes.md b/docs/en/docs/release-notes.md similarity index 100% rename from docs/release-notes.md rename to docs/en/docs/release-notes.md diff --git a/docs/tutorial/automatic-id-none-refresh.md b/docs/en/docs/tutorial/automatic-id-none-refresh.md similarity index 92% rename from docs/tutorial/automatic-id-none-refresh.md rename to docs/en/docs/tutorial/automatic-id-none-refresh.md index bbf74dd307..166550d870 100644 --- a/docs/tutorial/automatic-id-none-refresh.md +++ b/docs/en/docs/tutorial/automatic-id-none-refresh.md @@ -9,7 +9,7 @@ But the same `id` field actually **can be `None`** in the Python code, so we dec ```Python hl_lines="4" # Code above omitted 👆 -{!./docs_src/tutorial/automatic_id_none_refresh/tutorial001.py[ln:6-10]!} +{!../../docs_src/tutorial/automatic_id_none_refresh/tutorial001.py[ln:6-10]!} # Code below omitted 👇 ``` @@ -18,7 +18,7 @@ But the same `id` field actually **can be `None`** in the Python code, so we dec 👀 Full file preview ```Python -{!./docs_src/tutorial/automatic_id_none_refresh/tutorial001.py!} +{!../../docs_src/tutorial/automatic_id_none_refresh/tutorial001.py!} ``` @@ -34,7 +34,7 @@ When we create a new `Hero` instance, we don't set the `id`: ```Python hl_lines="3-6" # Code above omitted 👆 -{!./docs_src/tutorial/automatic_id_none_refresh/tutorial001.py[ln:23-26]!} +{!../../docs_src/tutorial/automatic_id_none_refresh/tutorial001.py[ln:23-26]!} # Code below ommitted 👇 ``` @@ -43,7 +43,7 @@ When we create a new `Hero` instance, we don't set the `id`: 👀 Full file preview ```Python -{!./docs_src/tutorial/automatic_id_none_refresh/tutorial001.py!} +{!../../docs_src/tutorial/automatic_id_none_refresh/tutorial001.py!} ``` @@ -77,7 +77,7 @@ We can confirm that by printing our heroes before adding them to the database: ```Python hl_lines="9-11" # Code above omitted 👆 -{!./docs_src/tutorial/automatic_id_none_refresh/tutorial001.py[ln:23-31]!} +{!../../docs_src/tutorial/automatic_id_none_refresh/tutorial001.py[ln:23-31]!} # Code below omitted 👇 ``` @@ -86,7 +86,7 @@ We can confirm that by printing our heroes before adding them to the database: 👀 Full file preview ```Python -{!./docs_src/tutorial/automatic_id_none_refresh/tutorial001.py!} +{!../../docs_src/tutorial/automatic_id_none_refresh/tutorial001.py!} ``` @@ -123,7 +123,7 @@ We can verify by creating a session using a `with` block and adding the objects. ```Python hl_lines="19-21" # Code above omitted 👆 -{!./docs_src/tutorial/automatic_id_none_refresh/tutorial001.py[ln:23-41]!} +{!../../docs_src/tutorial/automatic_id_none_refresh/tutorial001.py[ln:23-41]!} # Code below ommitted 👇 ``` @@ -132,7 +132,7 @@ We can verify by creating a session using a `with` block and adding the objects. 👀 Full file preview ```Python -{!./docs_src/tutorial/automatic_id_none_refresh/tutorial001.py!} +{!../../docs_src/tutorial/automatic_id_none_refresh/tutorial001.py!} ``` @@ -163,7 +163,7 @@ Then we can `commit` the changes in the session, and print again: ```Python hl_lines="13 16-18" # Code above omitted 👆 -{!./docs_src/tutorial/automatic_id_none_refresh/tutorial001.py[ln:33-48]!} +{!../../docs_src/tutorial/automatic_id_none_refresh/tutorial001.py[ln:33-48]!} # Code below omitted 👇 ``` @@ -172,7 +172,7 @@ Then we can `commit` the changes in the session, and print again: 👀 Full file preview ```Python -{!./docs_src/tutorial/automatic_id_none_refresh/tutorial001.py!} +{!../../docs_src/tutorial/automatic_id_none_refresh/tutorial001.py!} ``` @@ -236,7 +236,7 @@ To confirm and understand how this **automatic expiration and refresh** of data ```Python hl_lines="21-23 26-28" # Code above omitted 👆 -{!./docs_src/tutorial/automatic_id_none_refresh/tutorial001.py[ln:33-58]!} +{!../../docs_src/tutorial/automatic_id_none_refresh/tutorial001.py[ln:33-58]!} # Code below ommitted 👇 ``` @@ -245,7 +245,7 @@ To confirm and understand how this **automatic expiration and refresh** of data 👀 Full file preview ```Python -{!./docs_src/tutorial/automatic_id_none_refresh/tutorial001.py!} +{!../../docs_src/tutorial/automatic_id_none_refresh/tutorial001.py!} ``` @@ -333,7 +333,7 @@ You can do that too with `session.refresh(object)`: ```Python hl_lines="30-32 35-37" # Code above omitted 👆 -{!./docs_src/tutorial/automatic_id_none_refresh/tutorial001.py[ln:33-67]!} +{!../../docs_src/tutorial/automatic_id_none_refresh/tutorial001.py[ln:33-67]!} # Code below ommitted 👇 ``` @@ -342,7 +342,7 @@ You can do that too with `session.refresh(object)`: 👀 Full file preview ```Python -{!./docs_src/tutorial/automatic_id_none_refresh/tutorial001.py!} +{!../../docs_src/tutorial/automatic_id_none_refresh/tutorial001.py!} ``` @@ -406,7 +406,7 @@ There are no surprises here, it still works: ```Python hl_lines="40-42" # Code above omitted 👆 -{!./docs_src/tutorial/automatic_id_none_refresh/tutorial001.py[ln:33-72]!} +{!../../docs_src/tutorial/automatic_id_none_refresh/tutorial001.py[ln:33-72]!} # Code below omitted 👇 ``` @@ -415,7 +415,7 @@ There are no surprises here, it still works: 👀 Full file preview ```Python -{!./docs_src/tutorial/automatic_id_none_refresh/tutorial001.py!} +{!../../docs_src/tutorial/automatic_id_none_refresh/tutorial001.py!} ``` @@ -451,10 +451,10 @@ Now let's review all this code once again. And as we created the **engine** with `echo=True`, we can see the SQL statements being executed at each step. ```{ .python .annotate } -{!./docs_src/tutorial/automatic_id_none_refresh/tutorial002.py!} +{!../../docs_src/tutorial/automatic_id_none_refresh/tutorial002.py!} ``` -{!./docs_src/tutorial/automatic_id_none_refresh/annotations/en/tutorial002.md!} +{!../../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/en/docs/tutorial/code-structure.md similarity index 95% rename from docs/tutorial/code-structure.md rename to docs/en/docs/tutorial/code-structure.md index 59a9e4bd9a..a2e58217e6 100644 --- a/docs/tutorial/code-structure.md +++ b/docs/en/docs/tutorial/code-structure.md @@ -68,7 +68,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`: ```Python -{!./docs_src/tutorial/code_structure/tutorial001/models.py!} +{!../../docs_src/tutorial/code_structure/tutorial001/models.py!} ``` This way, you wouldn't have to deal with circular imports for other models. @@ -80,7 +80,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`: ```Python -{!./docs_src/tutorial/code_structure/tutorial001/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()`. @@ -90,7 +90,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`: ```Python hl_lines="3-4" -{!./docs_src/tutorial/code_structure/tutorial001/app.py!} +{!../../docs_src/tutorial/code_structure/tutorial001/app.py!} ``` Here we import the models, the engine, and the function to create all the tables and then we can use them all internally. @@ -205,7 +205,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`: ```Python hl_lines="1 5-6 16" -{!./docs_src/tutorial/code_structure/tutorial002/hero_model.py!} +{!../../docs_src/tutorial/code_structure/tutorial002/hero_model.py!} ``` Have 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. @@ -215,7 +215,7 @@ Have 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: ```Python hl_lines="1 5-6 14" -{!./docs_src/tutorial/code_structure/tutorial002/team_model.py!} +{!../../docs_src/tutorial/code_structure/tutorial002/team_model.py!} ``` Now we get editor support, autocompletion, inline errors, and **SQLModel** keeps working. 🎉 @@ -225,7 +225,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: ```Python hl_lines="4-5 10 12-14" -{!./docs_src/tutorial/code_structure/tutorial002/app.py!} +{!../../docs_src/tutorial/code_structure/tutorial002/app.py!} ``` 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/en/docs/tutorial/connect/create-connected-rows.md similarity index 91% rename from docs/tutorial/connect/create-connected-rows.md rename to docs/en/docs/tutorial/connect/create-connected-rows.md index 657edbde43..1784979b03 100644 --- a/docs/tutorial/connect/create-connected-rows.md +++ b/docs/en/docs/tutorial/connect/create-connected-rows.md @@ -46,7 +46,7 @@ We will continue with the code in the previous example and we will add more thin 👀 Full file preview ```Python -{!./docs_src/tutorial/connect/create_tables/tutorial001.py!} +{!../../docs_src/tutorial/connect/create_tables/tutorial001.py!} ``` @@ -64,7 +64,7 @@ Let's start by creating two teams: ```Python hl_lines="3-9" # Code above omitted 👆 -{!./docs_src/tutorial/connect/insert/tutorial001.py[ln:31-37]!} +{!../../docs_src/tutorial/connect/insert/tutorial001.py[ln:31-37]!} # Code below omitted 👇 ``` @@ -73,7 +73,7 @@ Let's start by creating two teams: 👀 Full file preview ```Python -{!./docs_src/tutorial/connect/insert/tutorial001.py!} +{!../../docs_src/tutorial/connect/insert/tutorial001.py!} ``` @@ -95,7 +95,7 @@ Let's not forget to add this function `create_heroes()` to the `main()` function ```Python hl_lines="5" # Code above omitted 👆 -{!./docs_src/tutorial/connect/insert/tutorial001.py[ln:63-65]!} +{!../../docs_src/tutorial/connect/insert/tutorial001.py[ln:63-65]!} # Code below omitted 👇 ``` @@ -104,7 +104,7 @@ Let's not forget to add this function `create_heroes()` to the `main()` function 👀 Full file preview ```Python -{!./docs_src/tutorial/connect/insert/tutorial001.py!} +{!../../docs_src/tutorial/connect/insert/tutorial001.py!} ``` @@ -143,7 +143,7 @@ As the `Hero` class model now has a field (column, attribute) `team_id`, we can ```Python hl_lines="12" # Code above omitted 👆 -{!./docs_src/tutorial/connect/insert/tutorial001.py[ln:31-41]!} +{!../../docs_src/tutorial/connect/insert/tutorial001.py[ln:31-41]!} # Code below omitted 👇 ``` @@ -152,7 +152,7 @@ As the `Hero` class model now has a field (column, attribute) `team_id`, we can 👀 Full file preview ```Python -{!./docs_src/tutorial/connect/insert/tutorial001.py!} +{!../../docs_src/tutorial/connect/insert/tutorial001.py!} ``` @@ -182,7 +182,7 @@ Let's now create two more heroes: ```Python hl_lines="14-20" # Code above omitted 👆 -{!./docs_src/tutorial/connect/insert/tutorial001.py[ln:31-52]!} +{!../../docs_src/tutorial/connect/insert/tutorial001.py[ln:31-52]!} # Code below omitted 👇 ``` @@ -191,7 +191,7 @@ Let's now create two more heroes: 👀 Full file preview ```Python -{!./docs_src/tutorial/connect/insert/tutorial001.py!} +{!../../docs_src/tutorial/connect/insert/tutorial001.py!} ``` @@ -228,7 +228,7 @@ Now let's refresh and print those new heroes to see their new ID pointing to the ```Python hl_lines="26-28 30-32" # Code above omitted 👆 -{!./docs_src/tutorial/connect/insert/tutorial001.py[ln:31-60]!} +{!../../docs_src/tutorial/connect/insert/tutorial001.py[ln:31-60]!} # Code below omitted 👇 ``` @@ -237,7 +237,7 @@ Now let's refresh and print those new heroes to see their new ID pointing to the 👀 Full file preview ```Python -{!./docs_src/tutorial/connect/insert/tutorial001.py!} +{!../../docs_src/tutorial/connect/insert/tutorial001.py!} ``` diff --git a/docs/tutorial/connect/create-connected-tables.md b/docs/en/docs/tutorial/connect/create-connected-tables.md similarity index 92% rename from docs/tutorial/connect/create-connected-tables.md rename to docs/en/docs/tutorial/connect/create-connected-tables.md index 452c904ebe..289e29cfc5 100644 --- a/docs/tutorial/connect/create-connected-tables.md +++ b/docs/en/docs/tutorial/connect/create-connected-tables.md @@ -58,7 +58,7 @@ Let's start by creating the tables in code. Import the things we need from `sqlmodel` and create a new `Team` model: ```Python hl_lines="6-9" -{!./docs_src/tutorial/connect/create_tables/tutorial001.py[ln:1-9]!} +{!../../docs_src/tutorial/connect/create_tables/tutorial001.py[ln:1-9]!} # Code below omitted 👇 ``` @@ -67,7 +67,7 @@ Import the things we need from `sqlmodel` and create a new `Team` model: 👀 Full file preview ```Python -{!./docs_src/tutorial/connect/create_tables/tutorial001.py!} +{!../../docs_src/tutorial/connect/create_tables/tutorial001.py!} ``` @@ -90,7 +90,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`: ```Python hl_lines="18" -{!./docs_src/tutorial/connect/create_tables/tutorial001.py[ln:1-18]!} +{!../../docs_src/tutorial/connect/create_tables/tutorial001.py[ln:1-18]!} # Code below omitted 👇 ``` @@ -99,7 +99,7 @@ This is the same model we have been using up to now, we are just adding the new 👀 Full file preview ```Python -{!./docs_src/tutorial/connect/create_tables/tutorial001.py!} +{!../../docs_src/tutorial/connect/create_tables/tutorial001.py!} ``` @@ -136,14 +136,14 @@ Now we can add the same code as before to create the engine and the function to ```Python hl_lines="3-4 6 9-10" # Code above omitted 👆 -{!./docs_src/tutorial/connect/create_tables/tutorial001.py[ln:21-28]!} +{!../../docs_src/tutorial/connect/create_tables/tutorial001.py[ln:21-28]!} ```
👀 Full file preview ```Python -{!./docs_src/tutorial/connect/create_tables/tutorial001.py!} +{!../../docs_src/tutorial/connect/create_tables/tutorial001.py!} ```
@@ -153,14 +153,14 @@ And as before, we'll call this function from another function `main()`, and we'l ```Python hl_lines="3-4 7-8" # Code above omitted 👆 -{!./docs_src/tutorial/connect/create_tables/tutorial001.py[ln:31-36]!} +{!../../docs_src/tutorial/connect/create_tables/tutorial001.py[ln:31-36]!} ```
👀 Full file preview ```Python -{!./docs_src/tutorial/connect/create_tables/tutorial001.py!} +{!../../docs_src/tutorial/connect/create_tables/tutorial001.py!} ```
diff --git a/docs/tutorial/connect/index.md b/docs/en/docs/tutorial/connect/index.md similarity index 100% rename from docs/tutorial/connect/index.md rename to docs/en/docs/tutorial/connect/index.md diff --git a/docs/tutorial/connect/read-connected-data.md b/docs/en/docs/tutorial/connect/read-connected-data.md similarity index 94% rename from docs/tutorial/connect/read-connected-data.md rename to docs/en/docs/tutorial/connect/read-connected-data.md index 88cd754607..7a2f27458e 100644 --- a/docs/tutorial/connect/read-connected-data.md +++ b/docs/en/docs/tutorial/connect/read-connected-data.md @@ -39,7 +39,7 @@ We will continue with the code in the previous example and we will add more thin 👀 Full file preview ```Python -{!./docs_src/tutorial/connect/insert/tutorial001.py!} +{!../../docs_src/tutorial/connect/insert/tutorial001.py!} ``` @@ -121,7 +121,7 @@ So, we can pass the `Hero` and `Team` model classes. And we can also use both th ```Python hl_lines="5" # Code above omitted 👆 -{!./docs_src/tutorial/connect/select/tutorial001.py[ln:63-65]!} +{!../../docs_src/tutorial/connect/select/tutorial001.py[ln:63-65]!} # Code below omitted 👇 ``` @@ -130,7 +130,7 @@ So, we can pass the `Hero` and `Team` model classes. And we can also use both th 👀 Full file preview ```Python -{!./docs_src/tutorial/connect/select/tutorial001.py!} +{!../../docs_src/tutorial/connect/select/tutorial001.py!} ``` @@ -146,7 +146,7 @@ And as we used `select` with two models, we will receive tuples of instances of ```Python hl_lines="7" # Code above omitted 👆 -{!./docs_src/tutorial/connect/select/tutorial001.py[ln:63-68]!} +{!../../docs_src/tutorial/connect/select/tutorial001.py[ln:63-68]!} # Code below omitted 👇 ``` @@ -155,7 +155,7 @@ And as we used `select` with two models, we will receive tuples of instances of 👀 Full file preview ```Python -{!./docs_src/tutorial/connect/select/tutorial001.py!} +{!../../docs_src/tutorial/connect/select/tutorial001.py!} ``` @@ -176,7 +176,7 @@ As always, we must remember to add this new `select_heroes()` function to the `m ```Python hl_lines="6" # Code above omitted 👆 -{!./docs_src/tutorial/connect/select/tutorial001.py[ln:71-74]!} +{!../../docs_src/tutorial/connect/select/tutorial001.py[ln:71-74]!} # Code below omitted 👇 ``` @@ -185,7 +185,7 @@ As always, we must remember to add this new `select_heroes()` function to the `m 👀 Full file preview ```Python -{!./docs_src/tutorial/connect/select/tutorial001.py!} +{!../../docs_src/tutorial/connect/select/tutorial001.py!} ``` @@ -295,7 +295,7 @@ And in SQLModel (actually SQLAlchemy), when using the `.join()`, because we alre ```Python hl_lines="5" # Code above omitted 👆 -{!./docs_src/tutorial/connect/select/tutorial002.py[ln:63-68]!} +{!../../docs_src/tutorial/connect/select/tutorial002.py[ln:63-68]!} # Code below omitted 👇 ``` @@ -304,7 +304,7 @@ And in SQLModel (actually SQLAlchemy), when using the `.join()`, because we alre 👀 Full file preview ```Python -{!./docs_src/tutorial/connect/select/tutorial002.py!} +{!../../docs_src/tutorial/connect/select/tutorial002.py!} ``` @@ -434,7 +434,7 @@ Now let's replicate the same query in **SQLModel**. ```Python hl_lines="5" # Code above omitted 👆 -{!./docs_src/tutorial/connect/select/tutorial003.py[ln:63-68]!} +{!../../docs_src/tutorial/connect/select/tutorial003.py[ln:63-68]!} # Code below omitted 👇 ``` @@ -443,7 +443,7 @@ Now let's replicate the same query in **SQLModel**. 👀 Full file preview ```Python -{!./docs_src/tutorial/connect/select/tutorial003.py!} +{!../../docs_src/tutorial/connect/select/tutorial003.py!} ``` @@ -496,7 +496,7 @@ We could even add some additional `.where()` after `.join()` to filter the data ```Python hl_lines="5" # Code above omitted 👆 -{!./docs_src/tutorial/connect/select/tutorial004.py[ln:63-68]!} +{!../../docs_src/tutorial/connect/select/tutorial004.py[ln:63-68]!} # Code below omitted 👇 ``` @@ -505,7 +505,7 @@ We could even add some additional `.where()` after `.join()` to filter the data 👀 Full file preview ```Python -{!./docs_src/tutorial/connect/select/tutorial004.py!} +{!../../docs_src/tutorial/connect/select/tutorial004.py!} ``` @@ -542,7 +542,7 @@ By putting the `Team` in `select()` we tell **SQLModel** and the database that w ```Python hl_lines="5" # Code above omitted 👆 -{!./docs_src/tutorial/connect/select/tutorial005.py[ln:63-68]!} +{!../../docs_src/tutorial/connect/select/tutorial005.py[ln:63-68]!} # Code below omitted 👇 ``` @@ -551,7 +551,7 @@ By putting the `Team` in `select()` we tell **SQLModel** and the database that w 👀 Full file preview ```Python -{!./docs_src/tutorial/connect/select/tutorial005.py!} +{!../../docs_src/tutorial/connect/select/tutorial005.py!} ``` diff --git a/docs/tutorial/connect/remove-data-connections.md b/docs/en/docs/tutorial/connect/remove-data-connections.md similarity index 90% rename from docs/tutorial/connect/remove-data-connections.md rename to docs/en/docs/tutorial/connect/remove-data-connections.md index f44559b3d1..ae30f7c344 100644 --- a/docs/tutorial/connect/remove-data-connections.md +++ b/docs/en/docs/tutorial/connect/remove-data-connections.md @@ -39,7 +39,7 @@ We will continue with the code from the previous chapter. 👀 Full file preview ```Python -{!./docs_src/tutorial/connect/update/tutorial001.py!} +{!../../docs_src/tutorial/connect/update/tutorial001.py!} ``` @@ -55,11 +55,11 @@ We can simply set the `team_id` to `None`, and now it doesn't have a connection ```Python hl_lines="8" # Code above omitted 👆 -{!./docs_src/tutorial/connect/delete/tutorial001.py[ln:31-32]!} +{!../../docs_src/tutorial/connect/delete/tutorial001.py[ln:31-32]!} # Previous code here omitted 👈 -{!./docs_src/tutorial/connect/delete/tutorial001.py[ln:68-72]!} +{!../../docs_src/tutorial/connect/delete/tutorial001.py[ln:68-72]!} # Code below omitted 👇 ``` @@ -68,7 +68,7 @@ We can simply set the `team_id` to `None`, and now it doesn't have a connection 👀 Full file preview ```Python -{!./docs_src/tutorial/connect/delete/tutorial001.py!} +{!../../docs_src/tutorial/connect/delete/tutorial001.py!} ``` diff --git a/docs/tutorial/connect/update-data-connections.md b/docs/en/docs/tutorial/connect/update-data-connections.md similarity index 90% rename from docs/tutorial/connect/update-data-connections.md rename to docs/en/docs/tutorial/connect/update-data-connections.md index b7c8b0daa1..9f0300038f 100644 --- a/docs/tutorial/connect/update-data-connections.md +++ b/docs/en/docs/tutorial/connect/update-data-connections.md @@ -41,7 +41,7 @@ We will continue with the code we used to create some heroes, and we'll update t 👀 Full file preview ```Python -{!./docs_src/tutorial/connect/insert/tutorial001.py!} +{!../../docs_src/tutorial/connect/insert/tutorial001.py!} ``` @@ -55,11 +55,11 @@ Doing it is just like updating any other field: ```Python hl_lines="8" # Code above omitted 👆 -{!./docs_src/tutorial/connect/update/tutorial001.py[ln:31-32]!} +{!../../docs_src/tutorial/connect/update/tutorial001.py[ln:31-32]!} # Previous code here omitted 👈 -{!./docs_src/tutorial/connect/update/tutorial001.py[ln:62-66]!} +{!../../docs_src/tutorial/connect/update/tutorial001.py[ln:62-66]!} # Code below omitted 👇 ``` @@ -68,7 +68,7 @@ Doing it is just like updating any other field: 👀 Full file preview ```Python -{!./docs_src/tutorial/connect/update/tutorial001.py!} +{!../../docs_src/tutorial/connect/update/tutorial001.py!} ``` diff --git a/docs/tutorial/create-db-and-table-with-db-browser.md b/docs/en/docs/tutorial/create-db-and-table-with-db-browser.md similarity index 100% rename from docs/tutorial/create-db-and-table-with-db-browser.md rename to docs/en/docs/tutorial/create-db-and-table-with-db-browser.md diff --git a/docs/tutorial/create-db-and-table.md b/docs/en/docs/tutorial/create-db-and-table.md similarity index 93% rename from docs/tutorial/create-db-and-table.md rename to docs/en/docs/tutorial/create-db-and-table.md index abd73cb797..14651e876e 100644 --- a/docs/tutorial/create-db-and-table.md +++ b/docs/en/docs/tutorial/create-db-and-table.md @@ -39,7 +39,7 @@ A class like this that represents some data is commonly called a **model**. 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: ```Python hl_lines="3 6" -{!./docs_src/tutorial/create_db_and_table/tutorial001.py[ln:1-10]!} +{!../../docs_src/tutorial/create_db_and_table/tutorial001.py[ln:1-10]!} # More code here later 👇 ``` @@ -48,7 +48,7 @@ For that, we will import `SQLModel` (plus other things we will also use) and cre 👀 Full file preview ```Python -{!./docs_src/tutorial/create_db_and_table/tutorial001.py!} +{!../../docs_src/tutorial/create_db_and_table/tutorial001.py!} ``` @@ -71,7 +71,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: ```Python hl_lines="1 3 7-10" -{!./docs_src/tutorial/create_db_and_table/tutorial001.py[ln:1-10]!} +{!../../docs_src/tutorial/create_db_and_table/tutorial001.py[ln:1-10]!} # More code here later 👇 ``` @@ -80,7 +80,7 @@ And the type of each of them will also be the type of table column: 👀 Full file preview ```Python -{!./docs_src/tutorial/create_db_and_table/tutorial001.py!} +{!../../docs_src/tutorial/create_db_and_table/tutorial001.py!} ``` @@ -98,7 +98,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`. ```Python hl_lines="1 10" -{!./docs_src/tutorial/create_db_and_table/tutorial001.py[ln:1-10]!} +{!../../docs_src/tutorial/create_db_and_table/tutorial001.py[ln:1-10]!} # More code here later 👇 ``` @@ -107,7 +107,7 @@ And we also set the default value of `age` to `None`. 👀 Full file preview ```Python -{!./docs_src/tutorial/create_db_and_table/tutorial001.py!} +{!../../docs_src/tutorial/create_db_and_table/tutorial001.py!} ``` @@ -135,7 +135,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`: ```Python hl_lines="3 7" -{!./docs_src/tutorial/create_db_and_table/tutorial001.py[ln:1-10]!} +{!../../docs_src/tutorial/create_db_and_table/tutorial001.py[ln:1-10]!} # More code here later 👇 ``` @@ -144,7 +144,7 @@ To do that, we use the special `Field` function from `sqlmodel` and set the argu 👀 Full file preview ```Python -{!./docs_src/tutorial/create_db_and_table/tutorial001.py!} +{!../../docs_src/tutorial/create_db_and_table/tutorial001.py!} ``` @@ -191,7 +191,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: ```Python hl_lines="3 16" -{!./docs_src/tutorial/create_db_and_table/tutorial001.py[ln:1-16]!} +{!../../docs_src/tutorial/create_db_and_table/tutorial001.py[ln:1-16]!} # More code here later 👇 ``` @@ -200,7 +200,7 @@ Creating the **engine** is very simple, just call `create_engine()` with a URL f 👀 Full file preview ```Python -{!./docs_src/tutorial/create_db_and_table/tutorial001.py!} +{!../../docs_src/tutorial/create_db_and_table/tutorial001.py!} ``` @@ -225,7 +225,7 @@ For SQLAlchemy, there's also a special one, which is a database all *in memory*, * `sqlite://` ```Python hl_lines="13-14 16" -{!./docs_src/tutorial/create_db_and_table/tutorial001.py[ln:1-19]!} +{!../../docs_src/tutorial/create_db_and_table/tutorial001.py[ln:1-19]!} # More code here later 👇 ``` @@ -234,7 +234,7 @@ For SQLAlchemy, there's also a special one, which is a database all *in memory*, 👀 Full file preview ```Python -{!./docs_src/tutorial/create_db_and_table/tutorial001.py!} +{!../../docs_src/tutorial/create_db_and_table/tutorial001.py!} ``` @@ -250,7 +250,7 @@ It will make the engine print all the SQL statements it executes, which can help It is particularly useful for **learning** and **debugging**: ```Python hl_lines="16" -{!./docs_src/tutorial/create_db_and_table/tutorial001.py[ln:1-16]!} +{!../../docs_src/tutorial/create_db_and_table/tutorial001.py[ln:1-16]!} # More code here later 👇 ``` @@ -259,7 +259,7 @@ It is particularly useful for **learning** and **debugging**: 👀 Full file preview ```Python -{!./docs_src/tutorial/create_db_and_table/tutorial001.py!} +{!../../docs_src/tutorial/create_db_and_table/tutorial001.py!} ``` @@ -286,7 +286,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: ```Python hl_lines="18" -{!./docs_src/tutorial/create_db_and_table/tutorial001.py!} +{!../../docs_src/tutorial/create_db_and_table/tutorial001.py!} ``` !!! tip @@ -399,7 +399,7 @@ Put the code it in a file `app.py` if you haven't already. 👀 Full file preview ```Python -{!./docs_src/tutorial/create_db_and_table/tutorial001.py!} +{!../../docs_src/tutorial/create_db_and_table/tutorial001.py!} ``` @@ -499,7 +499,7 @@ In this example it's just the `SQLModel.metadata.create_all(engine)`. Let's put it in a function `create_db_and_tables()`: ```Python hl_lines="19-20" -{!./docs_src/tutorial/create_db_and_table/tutorial002.py[ln:1-20]!} +{!../../docs_src/tutorial/create_db_and_table/tutorial002.py[ln:1-20]!} # More code here later 👇 ``` @@ -508,7 +508,7 @@ Let's put it in a function `create_db_and_tables()`: 👀 Full file preview ```Python -{!./docs_src/tutorial/create_db_and_table/tutorial002.py!} +{!../../docs_src/tutorial/create_db_and_table/tutorial002.py!} ``` @@ -536,7 +536,7 @@ But we still want it to **create the database and table** when we call it with P For that we can use the special variable `__name__` in an `if` block: ```Python hl_lines="23-24" -{!./docs_src/tutorial/create_db_and_table/tutorial002.py!} +{!../../docs_src/tutorial/create_db_and_table/tutorial002.py!} ``` ### About `__name__ == "__main__"` @@ -626,10 +626,10 @@ But now we can import things from this module in other files. Now, let's give the code a final look: ```{.python .annotate} -{!./docs_src/tutorial/create_db_and_table/tutorial003.py!} +{!../../docs_src/tutorial/create_db_and_table/tutorial003.py!} ``` -{!./docs_src/tutorial/create_db_and_table/annotations/en/tutorial003.md!} +{!../../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/en/docs/tutorial/delete.md similarity index 88% rename from docs/tutorial/delete.md rename to docs/en/docs/tutorial/delete.md index 0c9238d018..6de637b966 100644 --- a/docs/tutorial/delete.md +++ b/docs/en/docs/tutorial/delete.md @@ -10,7 +10,7 @@ As before, we'll continue from where we left off with the previous code. 👀 Full file preview ```Python -{!./docs_src/tutorial/update/tutorial003.py!} +{!../../docs_src/tutorial/update/tutorial003.py!} ``` @@ -66,7 +66,7 @@ We'll start by selecting the hero `"Spider-Youngster"` that we updated in the pr ```Python hl_lines="5" # Code above omitted 👆 -{!./docs_src/tutorial/delete/tutorial001.py[ln:72-77]!} +{!../../docs_src/tutorial/delete/tutorial001.py[ln:72-77]!} # Code below omitted 👇 ``` @@ -75,7 +75,7 @@ We'll start by selecting the hero `"Spider-Youngster"` that we updated in the pr 👀 Full file preview ```Python -{!./docs_src/tutorial/delete/tutorial001.py!} +{!../../docs_src/tutorial/delete/tutorial001.py!} ``` @@ -85,14 +85,14 @@ As this is a new function `delete_heroes()`, we'll also add it to the `main()` f ```Python hl_lines="7" # Code above omitted 👆 -{!./docs_src/tutorial/delete/tutorial001.py[ln:92-100]!} +{!../../docs_src/tutorial/delete/tutorial001.py[ln:92-100]!} ```
👀 Full file preview ```Python -{!./docs_src/tutorial/delete/tutorial001.py!} +{!../../docs_src/tutorial/delete/tutorial001.py!} ```
@@ -126,7 +126,7 @@ Now, very similar to how we used `session.add()` to add or update new heroes, we ```Python hl_lines="10" # Code above omitted 👆 -{!./docs_src/tutorial/delete/tutorial001.py[ln:72-79]!} +{!../../docs_src/tutorial/delete/tutorial001.py[ln:72-79]!} # Code below omitted 👇 ``` @@ -135,7 +135,7 @@ Now, very similar to how we used `session.add()` to add or update new heroes, we 👀 Full file preview ```Python -{!./docs_src/tutorial/delete/tutorial001.py!} +{!../../docs_src/tutorial/delete/tutorial001.py!} ``` @@ -149,7 +149,7 @@ This will save all the changes stored in the **session**, like the deleted hero: ```Python hl_lines="11" # Code above omitted 👆 -{!./docs_src/tutorial/delete/tutorial001.py[ln:72-80]!} +{!../../docs_src/tutorial/delete/tutorial001.py[ln:72-80]!} # Code below omitted 👇 ``` @@ -158,7 +158,7 @@ This will save all the changes stored in the **session**, like the deleted hero: 👀 Full file preview ```Python -{!./docs_src/tutorial/delete/tutorial001.py!} +{!../../docs_src/tutorial/delete/tutorial001.py!} ``` @@ -199,7 +199,7 @@ Because of that, the object still contains its attributes with the data in it, s ```Python hl_lines="13" # Code above omitted 👆 -{!./docs_src/tutorial/delete/tutorial001.py[ln:72-82]!} +{!../../docs_src/tutorial/delete/tutorial001.py[ln:72-82]!} # Code below omitted 👇 ``` @@ -208,7 +208,7 @@ Because of that, the object still contains its attributes with the data in it, s 👀 Full file preview ```Python -{!./docs_src/tutorial/delete/tutorial001.py!} +{!../../docs_src/tutorial/delete/tutorial001.py!} ``` @@ -237,7 +237,7 @@ To confirm if it was deleted, now let's query the database again, with the same ```Python hl_lines="15-17" # Code above omitted 👆 -{!./docs_src/tutorial/delete/tutorial001.py[ln:72-86]!} +{!../../docs_src/tutorial/delete/tutorial001.py[ln:72-86]!} # Code below omitted 👇 ``` @@ -246,7 +246,7 @@ To confirm if it was deleted, now let's query the database again, with the same 👀 Full file preview ```Python -{!./docs_src/tutorial/delete/tutorial001.py!} +{!../../docs_src/tutorial/delete/tutorial001.py!} ``` @@ -289,7 +289,7 @@ We'll do it by checking that the "first" item in the `results` is `None`: ```Python hl_lines="19-20" # Code above omitted 👆 -{!./docs_src/tutorial/delete/tutorial001.py[ln:72-89]!} +{!../../docs_src/tutorial/delete/tutorial001.py[ln:72-89]!} # Code below omitted 👇 ``` @@ -298,7 +298,7 @@ We'll do it by checking that the "first" item in the `results` is `None`: 👀 Full file preview ```Python -{!./docs_src/tutorial/delete/tutorial001.py!} +{!../../docs_src/tutorial/delete/tutorial001.py!} ``` @@ -328,10 +328,10 @@ INFO Engine ROLLBACK Now let's review all that code: ```{ .python .annotate hl_lines="72-90" } -{!./docs_src/tutorial/delete/tutorial002.py!} +{!../../docs_src/tutorial/delete/tutorial002.py!} ``` -{!./docs_src/tutorial/delete/annotations/en/tutorial002.md!} +{!../../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/en/docs/tutorial/fastapi/delete.md similarity index 88% rename from docs/tutorial/fastapi/delete.md rename to docs/en/docs/tutorial/fastapi/delete.md index a48122304b..a6a2112d5f 100644 --- a/docs/tutorial/fastapi/delete.md +++ b/docs/en/docs/tutorial/fastapi/delete.md @@ -15,7 +15,7 @@ And if we actually find a hero, we just delete it with the **session**. ```Python hl_lines="3-11" # Code above omitted 👆 -{!./docs_src/tutorial/fastapi/delete/tutorial001.py[ln:91-99]!} +{!../../docs_src/tutorial/fastapi/delete/tutorial001.py[ln:91-99]!} # Code below omitted 👇 ``` @@ -24,7 +24,7 @@ And if we actually find a hero, we just delete it with the **session**. 👀 Full file preview ```Python -{!./docs_src/tutorial/fastapi/delete/tutorial001.py!} +{!../../docs_src/tutorial/fastapi/delete/tutorial001.py!} ``` diff --git a/docs/tutorial/fastapi/index.md b/docs/en/docs/tutorial/fastapi/index.md similarity index 100% rename from docs/tutorial/fastapi/index.md rename to docs/en/docs/tutorial/fastapi/index.md diff --git a/docs/tutorial/fastapi/limit-and-offset.md b/docs/en/docs/tutorial/fastapi/limit-and-offset.md similarity index 91% rename from docs/tutorial/fastapi/limit-and-offset.md rename to docs/en/docs/tutorial/fastapi/limit-and-offset.md index 92bbfc7ee0..dc0352d8b2 100644 --- a/docs/tutorial/fastapi/limit-and-offset.md +++ b/docs/en/docs/tutorial/fastapi/limit-and-offset.md @@ -20,11 +20,11 @@ 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`. ```Python hl_lines="3 9 11" -{!./docs_src/tutorial/fastapi/limit_and_offset/tutorial001.py[ln:1-4]!} +{!../../docs_src/tutorial/fastapi/limit_and_offset/tutorial001.py[ln:1-4]!} # Code here omitted 👈 -{!./docs_src/tutorial/fastapi/limit_and_offset/tutorial001.py[ln:54-58]!} +{!../../docs_src/tutorial/fastapi/limit_and_offset/tutorial001.py[ln:54-58]!} # Code below omitted 👇 ``` @@ -33,7 +33,7 @@ And by default, we will return a maximum of `100` heroes, so `limit` will have a 👀 Full file preview ```Python -{!./docs_src/tutorial/fastapi/limit_and_offset/tutorial001.py!} +{!../../docs_src/tutorial/fastapi/limit_and_offset/tutorial001.py!} ``` diff --git a/docs/tutorial/fastapi/multiple-models.md b/docs/en/docs/tutorial/fastapi/multiple-models.md similarity index 93% rename from docs/tutorial/fastapi/multiple-models.md rename to docs/en/docs/tutorial/fastapi/multiple-models.md index c37fad386b..fd1749b831 100644 --- a/docs/tutorial/fastapi/multiple-models.md +++ b/docs/en/docs/tutorial/fastapi/multiple-models.md @@ -114,7 +114,7 @@ The simplest way to solve it could be to create **multiple models**, each one wi # Code above omitted 👆 -{!./docs_src/tutorial/fastapi/multiple_models/tutorial001.py[ln:7-24]!} +{!../../docs_src/tutorial/fastapi/multiple_models/tutorial001.py[ln:7-24]!} # Code below omitted 👇 ``` @@ -123,7 +123,7 @@ The simplest way to solve it could be to create **multiple models**, each one wi 👀 Full file preview ```Python -{!./docs_src/tutorial/fastapi/multiple_models/tutorial001.py!} +{!../../docs_src/tutorial/fastapi/multiple_models/tutorial001.py!} ``` @@ -148,7 +148,7 @@ Let's first check how is the process to create a hero now: ```Python hl_lines="3-4 6" # Code above omitted 👆 -{!./docs_src/tutorial/fastapi/multiple_models/tutorial001.py[ln:46-53]!} +{!../../docs_src/tutorial/fastapi/multiple_models/tutorial001.py[ln:46-53]!} # Code below omitted 👇 ``` @@ -157,7 +157,7 @@ Let's first check how is the process to create a hero now: 👀 Full file preview ```Python -{!./docs_src/tutorial/fastapi/multiple_models/tutorial001.py!} +{!../../docs_src/tutorial/fastapi/multiple_models/tutorial001.py!} ``` @@ -169,7 +169,7 @@ Now we use the type annotation `HeroCreate` for the request JSON data in the `he ```Python hl_lines="3" # Code above omitted 👆 -{!./docs_src/tutorial/fastapi/multiple_models/tutorial001.py[ln:47]!} +{!../../docs_src/tutorial/fastapi/multiple_models/tutorial001.py[ln:47]!} # Code below omitted 👇 ``` @@ -187,7 +187,7 @@ With this, we create a new `Hero` instance (the one for the database) and put it ```Python hl_lines="3" # Code above omitted 👆 -{!./docs_src/tutorial/fastapi/multiple_models/tutorial001.py[ln:49]!} +{!../../docs_src/tutorial/fastapi/multiple_models/tutorial001.py[ln:49]!} # Code below omitted 👇 ``` @@ -201,7 +201,7 @@ And now that we return it, FastAPI will validate the data with the `response_mod ```Python hl_lines="3" # Code above omitted 👆 -{!./docs_src/tutorial/fastapi/multiple_models/tutorial001.py[ln:46]!} +{!../../docs_src/tutorial/fastapi/multiple_models/tutorial001.py[ln:46]!} # Code below omitted 👇 ``` @@ -256,7 +256,7 @@ So let's create a **base** model `HeroBase` that the others can inherit from: ```Python hl_lines="3-6" # Code above omitted 👆 -{!./docs_src/tutorial/fastapi/multiple_models/tutorial002.py[ln:7-10]!} +{!../../docs_src/tutorial/fastapi/multiple_models/tutorial002.py[ln:7-10]!} # Code below omitted 👇 ``` @@ -265,7 +265,7 @@ So let's create a **base** model `HeroBase` that the others can inherit from: 👀 Full file preview ```Python -{!./docs_src/tutorial/fastapi/multiple_models/tutorial002.py!} +{!../../docs_src/tutorial/fastapi/multiple_models/tutorial002.py!} ``` @@ -281,7 +281,7 @@ Let's start with the only **table model**, the `Hero`: ```Python hl_lines="9-10" # Code above omitted 👆 -{!./docs_src/tutorial/fastapi/multiple_models/tutorial002.py[ln:7-14]!} +{!../../docs_src/tutorial/fastapi/multiple_models/tutorial002.py[ln:7-14]!} # Code below omitted 👇 ``` @@ -290,7 +290,7 @@ Let's start with the only **table model**, the `Hero`: 👀 Full file preview ```Python -{!./docs_src/tutorial/fastapi/multiple_models/tutorial002.py!} +{!../../docs_src/tutorial/fastapi/multiple_models/tutorial002.py!} ``` @@ -312,7 +312,7 @@ Notice that the parent model `HeroBase` is not a **table model**, but still, we ```Python hl_lines="4 6 9" # Code above omitted 👆 -{!./docs_src/tutorial/fastapi/multiple_models/tutorial002.py[ln:7-14]!} +{!../../docs_src/tutorial/fastapi/multiple_models/tutorial002.py[ln:7-14]!} # Code below omitted 👇 ``` @@ -321,7 +321,7 @@ Notice that the parent model `HeroBase` is not a **table model**, but still, we 👀 Full file preview ```Python -{!./docs_src/tutorial/fastapi/multiple_models/tutorial002.py!} +{!../../docs_src/tutorial/fastapi/multiple_models/tutorial002.py!} ``` @@ -339,7 +339,7 @@ This is a fun one: ```Python hl_lines="13-14" # Code above omitted 👆 -{!./docs_src/tutorial/fastapi/multiple_models/tutorial002.py[ln:7-18]!} +{!../../docs_src/tutorial/fastapi/multiple_models/tutorial002.py[ln:7-18]!} # Code below omitted 👇 ``` @@ -348,7 +348,7 @@ This is a fun one: 👀 Full file preview ```Python -{!./docs_src/tutorial/fastapi/multiple_models/tutorial002.py!} +{!../../docs_src/tutorial/fastapi/multiple_models/tutorial002.py!} ``` @@ -374,7 +374,7 @@ This one just declares that the `id` field is required when reading a hero from ```Python hl_lines="17-18" # Code above omitted 👆 -{!./docs_src/tutorial/fastapi/multiple_models/tutorial002.py[ln:7-22]!} +{!../../docs_src/tutorial/fastapi/multiple_models/tutorial002.py[ln:7-22]!} # Code below omitted 👇 ``` @@ -383,7 +383,7 @@ This one just declares that the `id` field is required when reading a hero from 👀 Full file preview ```Python -{!./docs_src/tutorial/fastapi/multiple_models/tutorial002.py!} +{!../../docs_src/tutorial/fastapi/multiple_models/tutorial002.py!} ``` diff --git a/docs/tutorial/fastapi/read-one.md b/docs/en/docs/tutorial/fastapi/read-one.md similarity index 78% rename from docs/tutorial/fastapi/read-one.md rename to docs/en/docs/tutorial/fastapi/read-one.md index 8eea6488b1..7937c4d620 100644 --- a/docs/tutorial/fastapi/read-one.md +++ b/docs/en/docs/tutorial/fastapi/read-one.md @@ -12,18 +12,18 @@ We want to get the hero based on the `id`, so we will use a **path parameter** ` If you need to refresh how *path parameters* work, including their data validation, check the FastAPI docs about Path Parameters. ```Python hl_lines="8" -{!./docs_src/tutorial/fastapi/read_one/tutorial001.py[ln:1-4]!} +{!../../docs_src/tutorial/fastapi/read_one/tutorial001.py[ln:1-4]!} # Code here omitted 👈 -{!./docs_src/tutorial/fastapi/read_one/tutorial001.py[ln:61-67]!} +{!../../docs_src/tutorial/fastapi/read_one/tutorial001.py[ln:61-67]!} ```
👀 Full file preview ```Python -{!./docs_src/tutorial/fastapi/read_one/tutorial001.py!} +{!../../docs_src/tutorial/fastapi/read_one/tutorial001.py!} ```
@@ -47,18 +47,18 @@ 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. ```Python hl_lines="3 11-13" -{!./docs_src/tutorial/fastapi/read_one/tutorial001.py[ln:1-4]!} +{!../../docs_src/tutorial/fastapi/read_one/tutorial001.py[ln:1-4]!} # Code here omitted 👈 -{!./docs_src/tutorial/fastapi/read_one/tutorial001.py[ln:61-67]!} +{!../../docs_src/tutorial/fastapi/read_one/tutorial001.py[ln:61-67]!} ```
👀 Full file preview ```Python -{!./docs_src/tutorial/fastapi/read_one/tutorial001.py!} +{!../../docs_src/tutorial/fastapi/read_one/tutorial001.py!} ```
@@ -70,18 +70,18 @@ Then, if the hero exists, we return it. And because we are using the `response_model` with `HeroRead`, it will be validated, documented, etc. ```Python hl_lines="8 14" -{!./docs_src/tutorial/fastapi/read_one/tutorial001.py[ln:1-4]!} +{!../../docs_src/tutorial/fastapi/read_one/tutorial001.py[ln:1-4]!} # Code here omitted 👈 -{!./docs_src/tutorial/fastapi/read_one/tutorial001.py[ln:61-67]!} +{!../../docs_src/tutorial/fastapi/read_one/tutorial001.py[ln:61-67]!} ```
👀 Full file preview ```Python -{!./docs_src/tutorial/fastapi/read_one/tutorial001.py!} +{!../../docs_src/tutorial/fastapi/read_one/tutorial001.py!} ```
diff --git a/docs/tutorial/fastapi/relationships.md b/docs/en/docs/tutorial/fastapi/relationships.md similarity index 92% rename from docs/tutorial/fastapi/relationships.md rename to docs/en/docs/tutorial/fastapi/relationships.md index 6921b5ac85..e94d69b9c8 100644 --- a/docs/tutorial/fastapi/relationships.md +++ b/docs/en/docs/tutorial/fastapi/relationships.md @@ -47,19 +47,19 @@ And the same way, we declared the `TeamRead` with only the same base fields of t ```Python hl_lines="3-5 9-10 14-19 23-24" # Code above omitted 👆 -{!./docs_src/tutorial/fastapi/teams/tutorial001.py[ln:7-9]!} +{!../../docs_src/tutorial/fastapi/teams/tutorial001.py[ln:7-9]!} # Code here omitted 👈 -{!./docs_src/tutorial/fastapi/teams/tutorial001.py[ln:22-23]!} +{!../../docs_src/tutorial/fastapi/teams/tutorial001.py[ln:22-23]!} # Code here omitted 👈 -{!./docs_src/tutorial/fastapi/teams/tutorial001.py[ln:31-36]!} +{!../../docs_src/tutorial/fastapi/teams/tutorial001.py[ln:31-36]!} # Code here omitted 👈 -{!./docs_src/tutorial/fastapi/teams/tutorial001.py[ln:45-46]!} +{!../../docs_src/tutorial/fastapi/teams/tutorial001.py[ln:45-46]!} # Code below omitted 👇 ``` @@ -68,7 +68,7 @@ And the same way, we declared the `TeamRead` with only the same base fields of t 👀 Full file preview ```Python -{!./docs_src/tutorial/fastapi/teams/tutorial001.py!} +{!../../docs_src/tutorial/fastapi/teams/tutorial001.py!} ``` @@ -80,11 +80,11 @@ In this case, we used `response_model=TeamRead` and `response_model=HeroRead`, s ```Python hl_lines="3 8 12 17" # Code above omitted 👆 -{!./docs_src/tutorial/fastapi/teams/tutorial001.py[ln:104-109]!} +{!../../docs_src/tutorial/fastapi/teams/tutorial001.py[ln:104-109]!} # Code here omitted 👈 -{!./docs_src/tutorial/fastapi/teams/tutorial001.py[ln:159-164]!} +{!../../docs_src/tutorial/fastapi/teams/tutorial001.py[ln:159-164]!} # Code below omitted 👇 ``` @@ -93,7 +93,7 @@ In this case, we used `response_model=TeamRead` and `response_model=HeroRead`, s 👀 Full file preview ```Python -{!./docs_src/tutorial/fastapi/teams/tutorial001.py!} +{!../../docs_src/tutorial/fastapi/teams/tutorial001.py!} ``` @@ -181,7 +181,7 @@ We'll add them **after** the other models so that we can easily reference the pr ```Python hl_lines="3-4 7-8" # Code above omitted 👆 -{!./docs_src/tutorial/fastapi/relationships/tutorial001.py[ln:61-66]!} +{!../../docs_src/tutorial/fastapi/relationships/tutorial001.py[ln:61-66]!} # Code below omitted 👇 ``` @@ -190,7 +190,7 @@ We'll add them **after** the other models so that we can easily reference the pr 👀 Full file preview ```Python -{!./docs_src/tutorial/fastapi/relationships/tutorial001.py!} +{!../../docs_src/tutorial/fastapi/relationships/tutorial001.py!} ``` @@ -230,11 +230,11 @@ In the case of the hero, this tells FastAPI to extract the `team` too. And in th ```Python hl_lines="3 8 12 17" # Code above omitted 👆 -{!./docs_src/tutorial/fastapi/relationships/tutorial001.py[ln:113-118]!} +{!../../docs_src/tutorial/fastapi/relationships/tutorial001.py[ln:113-118]!} # Code here omitted 👈 -{!./docs_src/tutorial/fastapi/relationships/tutorial001.py[ln:168-173]!} +{!../../docs_src/tutorial/fastapi/relationships/tutorial001.py[ln:168-173]!} # Code below omitted 👇 ``` @@ -243,7 +243,7 @@ In the case of the hero, this tells FastAPI to extract the `team` too. And in th 👀 Full file preview ```Python -{!./docs_src/tutorial/fastapi/relationships/tutorial001.py!} +{!../../docs_src/tutorial/fastapi/relationships/tutorial001.py!} ``` diff --git a/docs/tutorial/fastapi/response-model.md b/docs/en/docs/tutorial/fastapi/response-model.md similarity index 92% rename from docs/tutorial/fastapi/response-model.md rename to docs/en/docs/tutorial/fastapi/response-model.md index c019f4580b..a43ff4404c 100644 --- a/docs/tutorial/fastapi/response-model.md +++ b/docs/en/docs/tutorial/fastapi/response-model.md @@ -35,7 +35,7 @@ For example, we can pass the same `Hero` **SQLModel** class (because it is also ```Python hl_lines="3" # Code above omitted 👆 -{!./docs_src/tutorial/fastapi/response_model/tutorial001.py[ln:33-39]!} +{!../../docs_src/tutorial/fastapi/response_model/tutorial001.py[ln:33-39]!} # Code below omitted 👇 ``` @@ -44,7 +44,7 @@ For example, we can pass the same `Hero` **SQLModel** class (because it is also 👀 Full file preview ```Python -{!./docs_src/tutorial/fastapi/response_model/tutorial001.py!} +{!../../docs_src/tutorial/fastapi/response_model/tutorial001.py!} ``` @@ -56,11 +56,11 @@ We can also use other type annotations, the same way we can use with Pydantic fi First, we import `List` from `typing` and then we declare the `response_model` with `List[Hero]`: ```Python hl_lines="1 5" -{!./docs_src/tutorial/fastapi/response_model/tutorial001.py[ln:1]!} +{!../../docs_src/tutorial/fastapi/response_model/tutorial001.py[ln:1]!} # Code here omitted 👈 -{!./docs_src/tutorial/fastapi/response_model/tutorial001.py[ln:42-46]!} +{!../../docs_src/tutorial/fastapi/response_model/tutorial001.py[ln:42-46]!} # Code below omitted 👇 ``` @@ -69,7 +69,7 @@ First, we import `List` from `typing` and then we declare the `response_model` w 👀 Full file preview ```Python -{!./docs_src/tutorial/fastapi/response_model/tutorial001.py!} +{!../../docs_src/tutorial/fastapi/response_model/tutorial001.py!} ``` diff --git a/docs/tutorial/fastapi/session-with-dependency.md b/docs/en/docs/tutorial/fastapi/session-with-dependency.md similarity index 77% rename from docs/tutorial/fastapi/session-with-dependency.md rename to docs/en/docs/tutorial/fastapi/session-with-dependency.md index 52a800b9ea..71f1ead6b7 100644 --- a/docs/tutorial/fastapi/session-with-dependency.md +++ b/docs/en/docs/tutorial/fastapi/session-with-dependency.md @@ -9,7 +9,7 @@ Up to now, we have been creating a session in each *path operation*, in a `with` ```Python hl_lines="5" # Code above omitted 👆 -{!./docs_src/tutorial/fastapi/delete/tutorial001.py[ln:50-57]!} +{!../../docs_src/tutorial/fastapi/delete/tutorial001.py[ln:50-57]!} # Code below omitted 👇 ``` @@ -18,7 +18,7 @@ Up to now, we have been creating a session in each *path operation*, in a `with` 👀 Full file preview ```Python -{!./docs_src/tutorial/fastapi/delete/tutorial001.py!} +{!../../docs_src/tutorial/fastapi/delete/tutorial001.py!} ``` @@ -38,7 +38,7 @@ It could use `yield` instead of `return`, and in that case **FastAPI** will make ```Python hl_lines="3-5" # Code above omitted 👆 -{!./docs_src/tutorial/fastapi/session_with_dependency/tutorial001.py[ln:42-44]!} +{!../../docs_src/tutorial/fastapi/session_with_dependency/tutorial001.py[ln:42-44]!} # Code below omitted 👇 ``` @@ -47,7 +47,7 @@ It could use `yield` instead of `return`, and in that case **FastAPI** will make 👀 Full file preview ```Python -{!./docs_src/tutorial/fastapi/session_with_dependency/tutorial001.py!} +{!../../docs_src/tutorial/fastapi/session_with_dependency/tutorial001.py!} ``` @@ -59,15 +59,15 @@ 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. ```Python hl_lines="3 15" -{!./docs_src/tutorial/fastapi/session_with_dependency/tutorial001.py[ln:1-4]!} +{!../../docs_src/tutorial/fastapi/session_with_dependency/tutorial001.py[ln:1-4]!} # Code here omitted 👈 -{!./docs_src/tutorial/fastapi/session_with_dependency/tutorial001.py[ln:42-44]!} +{!../../docs_src/tutorial/fastapi/session_with_dependency/tutorial001.py[ln:42-44]!} # Code here omitted 👈 -{!./docs_src/tutorial/fastapi/session_with_dependency/tutorial001.py[ln:55-61]!} +{!../../docs_src/tutorial/fastapi/session_with_dependency/tutorial001.py[ln:55-61]!} # Code below omitted 👇 ``` @@ -76,7 +76,7 @@ We import `Depends()` from `fastapi`. Then we use it in the *path operation func 👀 Full file preview ```Python -{!./docs_src/tutorial/fastapi/session_with_dependency/tutorial001.py!} +{!../../docs_src/tutorial/fastapi/session_with_dependency/tutorial001.py!} ``` @@ -105,15 +105,15 @@ 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. ```Python hl_lines="16-20" -{!./docs_src/tutorial/fastapi/session_with_dependency/tutorial001.py[ln:1-4]!} +{!../../docs_src/tutorial/fastapi/session_with_dependency/tutorial001.py[ln:1-4]!} # Code here omitted 👈 -{!./docs_src/tutorial/fastapi/session_with_dependency/tutorial001.py[ln:42-44]!} +{!../../docs_src/tutorial/fastapi/session_with_dependency/tutorial001.py[ln:42-44]!} # Code here omitted 👈 -{!./docs_src/tutorial/fastapi/session_with_dependency/tutorial001.py[ln:55-61]!} +{!../../docs_src/tutorial/fastapi/session_with_dependency/tutorial001.py[ln:55-61]!} # Code below omitted 👇 ``` @@ -122,7 +122,7 @@ This means that in the main code of the *path operation function*, it will work 👀 Full file preview ```Python -{!./docs_src/tutorial/fastapi/session_with_dependency/tutorial001.py!} +{!../../docs_src/tutorial/fastapi/session_with_dependency/tutorial001.py!} ``` @@ -132,15 +132,15 @@ In fact, you could think that all that block of code inside of the `create_hero( But now, the `with` block is not explicitly in the function, but in the dependency above: ```Python hl_lines="9-10" -{!./docs_src/tutorial/fastapi/session_with_dependency/tutorial001.py[ln:1-4]!} +{!../../docs_src/tutorial/fastapi/session_with_dependency/tutorial001.py[ln:1-4]!} # Code here omitted 👈 -{!./docs_src/tutorial/fastapi/session_with_dependency/tutorial001.py[ln:42-44]!} +{!../../docs_src/tutorial/fastapi/session_with_dependency/tutorial001.py[ln:42-44]!} # Code here omitted 👈 -{!./docs_src/tutorial/fastapi/session_with_dependency/tutorial001.py[ln:55-61]!} +{!../../docs_src/tutorial/fastapi/session_with_dependency/tutorial001.py[ln:55-61]!} # Code below omitted 👇 ``` @@ -149,7 +149,7 @@ But now, the `with` block is not explicitly in the function, but in the dependen 👀 Full file preview ```Python -{!./docs_src/tutorial/fastapi/session_with_dependency/tutorial001.py!} +{!../../docs_src/tutorial/fastapi/session_with_dependency/tutorial001.py!} ``` @@ -169,22 +169,22 @@ session: Session = Depends(get_session) And then we remove the previous `with` block with the old **session**. ```Python hl_lines="15 26 35 44 59" -{!./docs_src/tutorial/fastapi/session_with_dependency/tutorial001.py[ln:1-4]!} +{!../../docs_src/tutorial/fastapi/session_with_dependency/tutorial001.py[ln:1-4]!} # Code here omitted 👈 -{!./docs_src/tutorial/fastapi/session_with_dependency/tutorial001.py[ln:42-44]!} +{!../../docs_src/tutorial/fastapi/session_with_dependency/tutorial001.py[ln:42-44]!} # Code here omitted 👈 -{!./docs_src/tutorial/fastapi/session_with_dependency/tutorial001.py[ln:55-107]!} +{!../../docs_src/tutorial/fastapi/session_with_dependency/tutorial001.py[ln:55-107]!} ```
👀 Full file preview ```Python -{!./docs_src/tutorial/fastapi/session_with_dependency/tutorial001.py!} +{!../../docs_src/tutorial/fastapi/session_with_dependency/tutorial001.py!} ```
diff --git a/docs/tutorial/fastapi/simple-hero-api.md b/docs/en/docs/tutorial/fastapi/simple-hero-api.md similarity index 91% rename from docs/tutorial/fastapi/simple-hero-api.md rename to docs/en/docs/tutorial/fastapi/simple-hero-api.md index 53a5fa7d38..a0f078c04c 100644 --- a/docs/tutorial/fastapi/simple-hero-api.md +++ b/docs/en/docs/tutorial/fastapi/simple-hero-api.md @@ -33,12 +33,12 @@ 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: ```Python hl_lines="20-21" -{!./docs_src/tutorial/fastapi/simple_hero_api/tutorial001.py[ln:1]!} +{!../../docs_src/tutorial/fastapi/simple_hero_api/tutorial001.py[ln:1]!} # One line of FastAPI imports here later 👈 -{!./docs_src/tutorial/fastapi/simple_hero_api/tutorial001.py[ln:4]!} +{!../../docs_src/tutorial/fastapi/simple_hero_api/tutorial001.py[ln:4]!} -{!./docs_src/tutorial/fastapi/simple_hero_api/tutorial001.py[ln:7-22]!} +{!../../docs_src/tutorial/fastapi/simple_hero_api/tutorial001.py[ln:7-22]!} # Code below omitted 👇 ``` @@ -47,7 +47,7 @@ This is almost the same code we have seen up to now in previous examples: 👀 Full file preview ```Python -{!./docs_src/tutorial/fastapi/simple_hero_api/tutorial001.py!} +{!../../docs_src/tutorial/fastapi/simple_hero_api/tutorial001.py!} ``` @@ -76,11 +76,11 @@ We will import the `FastAPI` class from `fastapi`. And then create an `app` object that is an instance of that `FastAPI` class: ```Python hl_lines="3 8" -{!./docs_src/tutorial/fastapi/simple_hero_api/tutorial001.py[ln:1-4]!} +{!../../docs_src/tutorial/fastapi/simple_hero_api/tutorial001.py[ln:1-4]!} # SQLModel code here omitted 👈 -{!./docs_src/tutorial/fastapi/simple_hero_api/tutorial001.py[ln:25]!} +{!../../docs_src/tutorial/fastapi/simple_hero_api/tutorial001.py[ln:25]!} # Code below omitted 👇 ``` @@ -89,7 +89,7 @@ And then create an `app` object that is an instance of that `FastAPI` class: 👀 Full file preview ```Python -{!./docs_src/tutorial/fastapi/simple_hero_api/tutorial001.py!} +{!../../docs_src/tutorial/fastapi/simple_hero_api/tutorial001.py!} ``` @@ -103,7 +103,7 @@ This should be called only once at startup, not before every request, so we put ```Python hl_lines="6-8" # Code above omitted 👆 -{!./docs_src/tutorial/fastapi/simple_hero_api/tutorial001.py[ln:25-30]!} +{!../../docs_src/tutorial/fastapi/simple_hero_api/tutorial001.py[ln:25-30]!} # Code below omitted 👇 ``` @@ -112,7 +112,7 @@ This should be called only once at startup, not before every request, so we put 👀 Full file preview ```Python -{!./docs_src/tutorial/fastapi/simple_hero_api/tutorial001.py!} +{!../../docs_src/tutorial/fastapi/simple_hero_api/tutorial001.py!} ``` @@ -129,7 +129,7 @@ It will be called when a user sends a request with a `POST` **operation** to the ```Python hl_lines="11-12" # Code above omitted 👆 -{!./docs_src/tutorial/fastapi/simple_hero_api/tutorial001.py[ln:25-39]!} +{!../../docs_src/tutorial/fastapi/simple_hero_api/tutorial001.py[ln:25-39]!} # Code below omitted 👇 ``` @@ -138,7 +138,7 @@ It will be called when a user sends a request with a `POST` **operation** to the 👀 Full file preview ```Python -{!./docs_src/tutorial/fastapi/simple_hero_api/tutorial001.py!} +{!../../docs_src/tutorial/fastapi/simple_hero_api/tutorial001.py!} ``` @@ -172,14 +172,14 @@ Now let's add another **path operation** to read all the heroes: ```Python hl_lines="20-24" # Code above omitted 👆 -{!./docs_src/tutorial/fastapi/simple_hero_api/tutorial001.py[ln:25-46]!} +{!../../docs_src/tutorial/fastapi/simple_hero_api/tutorial001.py[ln:25-46]!} ```
👀 Full file preview ```Python -{!./docs_src/tutorial/fastapi/simple_hero_api/tutorial001.py!} +{!../../docs_src/tutorial/fastapi/simple_hero_api/tutorial001.py!} ```
diff --git a/docs/tutorial/fastapi/teams.md b/docs/en/docs/tutorial/fastapi/teams.md similarity index 86% rename from docs/tutorial/fastapi/teams.md rename to docs/en/docs/tutorial/fastapi/teams.md index 0b19a95cb3..ba2d4ba91c 100644 --- a/docs/tutorial/fastapi/teams.md +++ b/docs/en/docs/tutorial/fastapi/teams.md @@ -19,7 +19,7 @@ Then we also inherit from the `TeamBase` for the `TeamCreate` and `TeamRead` **d And we also create a `TeamUpdate` **data model**. ```Python hl_lines="7-9 12-15 18-19 22-23 26-28" -{!./docs_src/tutorial/fastapi/teams/tutorial001.py[ln:1-28]!} +{!../../docs_src/tutorial/fastapi/teams/tutorial001.py[ln:1-28]!} # Code below omitted 👇 ``` @@ -28,7 +28,7 @@ And we also create a `TeamUpdate` **data model**. 👀 Full file preview ```Python -{!./docs_src/tutorial/fastapi/teams/tutorial001.py!} +{!../../docs_src/tutorial/fastapi/teams/tutorial001.py!} ``` @@ -42,7 +42,7 @@ Let's now update the `Hero` models too. ```Python hl_lines="3-8 11-15 17-18 21-22 25-29" # Code above omitted 👆 -{!./docs_src/tutorial/fastapi/teams/tutorial001.py[ln:31-57]!} +{!../../docs_src/tutorial/fastapi/teams/tutorial001.py[ln:31-57]!} # Code below omitted 👇 ``` @@ -51,7 +51,7 @@ Let's now update the `Hero` models too. 👀 Full file preview ```Python -{!./docs_src/tutorial/fastapi/teams/tutorial001.py!} +{!../../docs_src/tutorial/fastapi/teams/tutorial001.py!} ``` @@ -69,7 +69,7 @@ Notice that the **relationship attributes**, the ones with `Relationship()`, are ```Python hl_lines="11 38" # Code above omitted 👆 -{!./docs_src/tutorial/fastapi/teams/tutorial001.py[ln:7-57]!} +{!../../docs_src/tutorial/fastapi/teams/tutorial001.py[ln:7-57]!} # Code below omitted 👇 ``` @@ -78,7 +78,7 @@ Notice that the **relationship attributes**, the ones with `Relationship()`, are 👀 Full file preview ```Python -{!./docs_src/tutorial/fastapi/teams/tutorial001.py!} +{!../../docs_src/tutorial/fastapi/teams/tutorial001.py!} ``` @@ -92,7 +92,7 @@ These are equivalent and very similar to the **path operations** for the **heroe ```Python hl_lines="3-9 12-20 23-28 31-47 50-57" # Code above omitted 👆 -{!./docs_src/tutorial/fastapi/teams/tutorial001.py[ln:139-193]!} +{!../../docs_src/tutorial/fastapi/teams/tutorial001.py[ln:139-193]!} # Code below omitted 👇 ``` @@ -101,7 +101,7 @@ These are equivalent and very similar to the **path operations** for the **heroe 👀 Full file preview ```Python -{!./docs_src/tutorial/fastapi/teams/tutorial001.py!} +{!../../docs_src/tutorial/fastapi/teams/tutorial001.py!} ``` diff --git a/docs/tutorial/fastapi/tests.md b/docs/en/docs/tutorial/fastapi/tests.md similarity index 88% rename from docs/tutorial/fastapi/tests.md rename to docs/en/docs/tutorial/fastapi/tests.md index f817a883a1..4599250ef9 100644 --- a/docs/tutorial/fastapi/tests.md +++ b/docs/en/docs/tutorial/fastapi/tests.md @@ -18,7 +18,7 @@ Now we will see how useful it is to have this session dependency. ✨ 👀 Full file preview ```Python -{!./docs_src/tutorial/fastapi/app_testing/tutorial001/main.py!} +{!../../docs_src/tutorial/fastapi/app_testing/tutorial001/main.py!} ``` @@ -60,16 +60,16 @@ $ python -m pip install requests pytest Let's start with a simple test, with just the basic test code we need the check that the **FastAPI** application is creating a new hero correctly. ```{ .python .annotate } -{!./docs_src/tutorial/fastapi/app_testing/tutorial001/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/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/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/annotations/en/test_main_001.md!} +{!../../docs_src/tutorial/fastapi/app_testing/tutorial001/annotations/en/test_main_001.md!} !!! tip Check out the number bubbles to see what is done by each line of code. @@ -107,14 +107,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/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/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/annotations/en/test_main_002.md!} +{!../../docs_src/tutorial/fastapi/app_testing/tutorial001/annotations/en/test_main_002.md!} !!! tip Check out the number bubbles to see what is done by each line of code. @@ -132,10 +132,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/test_main_003.py!} +{!../../docs_src/tutorial/fastapi/app_testing/tutorial001/test_main_003.py!} ``` -{!./docs_src/tutorial/fastapi/app_testing/tutorial001/annotations/en/test_main_003.md!} +{!../../docs_src/tutorial/fastapi/app_testing/tutorial001/annotations/en/test_main_003.md!} ### Import Table Models @@ -190,12 +190,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/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/annotations/en/test_main_004.md!} +{!../../docs_src/tutorial/fastapi/app_testing/tutorial001/annotations/en/test_main_004.md!} !!! tip Check out the number bubbles to see what is done by each line of code. @@ -232,10 +232,10 @@ You can read more about them in the 👀 Full file preview ```Python -{!./docs_src/tutorial/fastapi/app_testing/tutorial001/test_main.py!} +{!../../docs_src/tutorial/fastapi/app_testing/tutorial001/test_main.py!} ``` @@ -322,11 +322,11 @@ 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**. ```Python hl_lines="6 10" -{!./docs_src/tutorial/fastapi/app_testing/tutorial001/test_main.py[ln:1-6]!} +{!../../docs_src/tutorial/fastapi/app_testing/tutorial001/test_main.py[ln:1-6]!} # Code here omitted 👈 -{!./docs_src/tutorial/fastapi/app_testing/tutorial001/test_main.py[ln:61-81]!} +{!../../docs_src/tutorial/fastapi/app_testing/tutorial001/test_main.py[ln:61-81]!} # Code below omitted 👇 ``` @@ -335,7 +335,7 @@ But for the next test function, we will require **both fixtures**, the **client* 👀 Full file preview ```Python -{!./docs_src/tutorial/fastapi/app_testing/tutorial001/test_main.py!} +{!../../docs_src/tutorial/fastapi/app_testing/tutorial001/test_main.py!} ``` @@ -367,14 +367,14 @@ Using the same ideas, requiring the fixtures, creating data that we need for the ```Python hl_lines="3 18 33" # Code above omitted 👆 -{!./docs_src/tutorial/fastapi/app_testing/tutorial001/test_main.py[ln:84-125]!} +{!../../docs_src/tutorial/fastapi/app_testing/tutorial001/test_main.py[ln:84-125]!} ```
👀 Full file preview ```Python -{!./docs_src/tutorial/fastapi/app_testing/tutorial001/test_main.py!} +{!../../docs_src/tutorial/fastapi/app_testing/tutorial001/test_main.py!} ```
diff --git a/docs/tutorial/fastapi/update.md b/docs/en/docs/tutorial/fastapi/update.md similarity index 90% rename from docs/tutorial/fastapi/update.md rename to docs/en/docs/tutorial/fastapi/update.md index 0b5292bd29..054f660560 100644 --- a/docs/tutorial/fastapi/update.md +++ b/docs/en/docs/tutorial/fastapi/update.md @@ -22,7 +22,7 @@ So, let's create this new `HeroUpdate` model: ```Python hl_lines="21-24" # Code above omitted 👆 -{!./docs_src/tutorial/fastapi/update/tutorial001.py[ln:7-28]!} +{!../../docs_src/tutorial/fastapi/update/tutorial001.py[ln:7-28]!} # Code below omitted 👇 ``` @@ -31,7 +31,7 @@ So, let's create this new `HeroUpdate` model: 👀 Full file preview ```Python -{!./docs_src/tutorial/fastapi/update/tutorial001.py!} +{!../../docs_src/tutorial/fastapi/update/tutorial001.py!} ``` @@ -47,7 +47,7 @@ We will use a `PATCH` HTTP operation. This is used to **partially update data**, ```Python hl_lines="3-4" # Code above omitted 👆 -{!./docs_src/tutorial/fastapi/update/tutorial001.py[ln:76-91]!} +{!../../docs_src/tutorial/fastapi/update/tutorial001.py[ln:76-91]!} # Code below omitted 👇 ``` @@ -56,7 +56,7 @@ We will use a `PATCH` HTTP operation. This is used to **partially update data**, 👀 Full file preview ```Python -{!./docs_src/tutorial/fastapi/update/tutorial001.py!} +{!../../docs_src/tutorial/fastapi/update/tutorial001.py!} ``` @@ -72,7 +72,7 @@ So, we need to read the hero from the database, with the **same logic** we used ```Python hl_lines="6-8" # Code above omitted 👆 -{!./docs_src/tutorial/fastapi/update/tutorial001.py[ln:76-91]!} +{!../../docs_src/tutorial/fastapi/update/tutorial001.py[ln:76-91]!} # Code below omitted 👇 ``` @@ -81,7 +81,7 @@ So, we need to read the hero from the database, with the **same logic** we used 👀 Full file preview ```Python -{!./docs_src/tutorial/fastapi/update/tutorial001.py!} +{!../../docs_src/tutorial/fastapi/update/tutorial001.py!} ``` @@ -139,7 +139,7 @@ Then we use that to get the data that was actually sent by the client: ```Python hl_lines="9" # Code above omitted 👆 -{!./docs_src/tutorial/fastapi/update/tutorial001.py[ln:76-91]!} +{!../../docs_src/tutorial/fastapi/update/tutorial001.py[ln:76-91]!} # Code below omitted 👇 ``` @@ -148,7 +148,7 @@ Then we use that to get the data that was actually sent by the client: 👀 Full file preview ```Python -{!./docs_src/tutorial/fastapi/update/tutorial001.py!} +{!../../docs_src/tutorial/fastapi/update/tutorial001.py!} ``` @@ -160,7 +160,7 @@ Now that we have a **dictionary with the data sent by the client**, we can itera ```Python hl_lines="10-11" # Code above omitted 👆 -{!./docs_src/tutorial/fastapi/update/tutorial001.py[ln:76-91]!} +{!../../docs_src/tutorial/fastapi/update/tutorial001.py[ln:76-91]!} # Code below omitted 👇 ``` @@ -169,7 +169,7 @@ Now that we have a **dictionary with the data sent by the client**, we can itera 👀 Full file preview ```Python -{!./docs_src/tutorial/fastapi/update/tutorial001.py!} +{!../../docs_src/tutorial/fastapi/update/tutorial001.py!} ``` diff --git a/docs/tutorial/index.md b/docs/en/docs/tutorial/index.md similarity index 100% rename from docs/tutorial/index.md rename to docs/en/docs/tutorial/index.md diff --git a/docs/tutorial/indexes.md b/docs/en/docs/tutorial/indexes.md similarity index 97% rename from docs/tutorial/indexes.md rename to docs/en/docs/tutorial/indexes.md index 6513d7d462..1fe5983e31 100644 --- a/docs/tutorial/indexes.md +++ b/docs/en/docs/tutorial/indexes.md @@ -24,7 +24,7 @@ Fine, in that case, you can **sneak peek** the final code to create indexes here 👀 Full file preview ```Python hl_lines="8 10" -{!./docs_src/tutorial/indexes/tutorial002.py!} +{!../../docs_src/tutorial/indexes/tutorial002.py!} ``` @@ -262,7 +262,7 @@ The change in code is underwhelming, it's very simple. 😆 Here's the `Hero` model we had before: ```Python hl_lines="8" -{!./docs_src/tutorial/where/tutorial001.py[ln:1-10]!} +{!../../docs_src/tutorial/where/tutorial001.py[ln:1-10]!} # Code below omitted 👇 ``` @@ -271,7 +271,7 @@ Here's the `Hero` model we had before: 👀 Full file preview ```Python -{!./docs_src/tutorial/where/tutorial001.py!} +{!../../docs_src/tutorial/where/tutorial001.py!} ``` @@ -279,7 +279,7 @@ Here's the `Hero` model we had before: Let's now update it to tell **SQLModel** to create an index for the `name` field when creating the table: ```Python hl_lines="8" -{!./docs_src/tutorial/indexes/tutorial001.py[ln:1-10]!} +{!../../docs_src/tutorial/indexes/tutorial001.py[ln:1-10]!} # Code below omitted 👇 ``` @@ -288,7 +288,7 @@ Let's now update it to tell **SQLModel** to create an index for the `name` field 👀 Full file preview ```Python -{!./docs_src/tutorial/indexes/tutorial001.py!} +{!../../docs_src/tutorial/indexes/tutorial001.py!} ``` @@ -313,7 +313,7 @@ This is great because it means that indexes are very **simple to use**. But it m ```Python hl_lines="5" # Code above omitted 👆 -{!./docs_src/tutorial/indexes/tutorial001.py[ln:36-41]!} +{!../../docs_src/tutorial/indexes/tutorial001.py[ln:36-41]!} # Code below omitted 👇 ``` @@ -322,7 +322,7 @@ This is great because it means that indexes are very **simple to use**. But it m 👀 Full file preview ```Python -{!./docs_src/tutorial/indexes/tutorial001.py!} +{!../../docs_src/tutorial/indexes/tutorial001.py!} ``` @@ -369,7 +369,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: ```Python hl_lines="10" -{!./docs_src/tutorial/indexes/tutorial002.py[ln:1-10]!} +{!../../docs_src/tutorial/indexes/tutorial002.py[ln:1-10]!} # Code below omitted 👇 ``` @@ -378,7 +378,7 @@ We are going to query the `hero` table doing comparisons on the `age` field too, 👀 Full file preview ```Python -{!./docs_src/tutorial/indexes/tutorial002.py!} +{!../../docs_src/tutorial/indexes/tutorial002.py!} ``` diff --git a/docs/tutorial/insert.md b/docs/en/docs/tutorial/insert.md similarity index 90% rename from docs/tutorial/insert.md rename to docs/en/docs/tutorial/insert.md index 5947e1e5dc..1f53dbfd04 100644 --- a/docs/tutorial/insert.md +++ b/docs/en/docs/tutorial/insert.md @@ -26,14 +26,14 @@ We will continue from where we left of in the last chapter. This is the code we had to create the database and table, nothing new here: ```{.python .annotate hl_lines="22" } -{!./docs_src/tutorial/create_db_and_table/tutorial003.py[ln:1-20]!} +{!../../docs_src/tutorial/create_db_and_table/tutorial003.py[ln:1-20]!} # More code here later 👈 -{!./docs_src/tutorial/create_db_and_table/tutorial003.py[ln:23-24]!} +{!../../docs_src/tutorial/create_db_and_table/tutorial003.py[ln:23-24]!} ``` -{!./docs_src/tutorial/create_db_and_table/annotations/en/tutorial003.md!} +{!../../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 on the same file to create the data. @@ -127,7 +127,7 @@ We'll create 3 right away, for the 3 heroes: ```Python # Code above omitted 👆 -{!./docs_src/tutorial/insert/tutorial002.py[ln:23-26]!} +{!../../docs_src/tutorial/insert/tutorial002.py[ln:23-26]!} # More code here later 👇 ``` @@ -136,7 +136,7 @@ We'll create 3 right away, for the 3 heroes: 👀 Full file preview ```Python -{!./docs_src/tutorial/insert/tutorial002.py!} +{!../../docs_src/tutorial/insert/tutorial002.py!} ``` @@ -169,7 +169,7 @@ We would re-use the same **engine** in all the code, everywhere in the applicati The first step is to import the `Session` class: ```Python hl_lines="3" -{!./docs_src/tutorial/insert/tutorial001.py[ln:1-3]!} +{!../../docs_src/tutorial/insert/tutorial001.py[ln:1-3]!} # Code below ommitted 👇 ``` @@ -178,7 +178,7 @@ The first step is to import the `Session` class: 👀 Full file preview ```Python -{!./docs_src/tutorial/insert/tutorial001.py!} +{!../../docs_src/tutorial/insert/tutorial001.py!} ``` @@ -188,7 +188,7 @@ Then we can create a new session: ```Python hl_lines="8" # Code above omitted 👆 -{!./docs_src/tutorial/insert/tutorial001.py[ln:23-28]!} +{!../../docs_src/tutorial/insert/tutorial001.py[ln:23-28]!} # More code here later 👇 ``` @@ -197,7 +197,7 @@ Then we can create a new session: 👀 Full file preview ```Python -{!./docs_src/tutorial/insert/tutorial001.py!} +{!../../docs_src/tutorial/insert/tutorial001.py!} ``` @@ -213,7 +213,7 @@ Now that we have some hero model instances (some objects in memory) and a **sess ```Python hl_lines="9-11" # Code above omitted 👆 -{!./docs_src/tutorial/insert/tutorial001.py[ln:23-32]!} +{!../../docs_src/tutorial/insert/tutorial001.py[ln:23-32]!} # More code here later 👇 ``` @@ -222,7 +222,7 @@ Now that we have some hero model instances (some objects in memory) and a **sess 👀 Full file preview ```Python -{!./docs_src/tutorial/insert/tutorial001.py!} +{!../../docs_src/tutorial/insert/tutorial001.py!} ``` @@ -248,7 +248,7 @@ Now that we have the heroes in the **session** and that we are ready to save all ```Python hl_lines="13" # Code above omitted 👆 -{!./docs_src/tutorial/insert/tutorial001.py[ln:23-34]!} +{!../../docs_src/tutorial/insert/tutorial001.py[ln:23-34]!} # More code here later 👇 ``` @@ -257,7 +257,7 @@ Now that we have the heroes in the **session** and that we are ready to save all 👀 Full file preview ```Python -{!./docs_src/tutorial/insert/tutorial001.py!} +{!../../docs_src/tutorial/insert/tutorial001.py!} ``` @@ -289,7 +289,7 @@ But to keep things a bit more organized, let's instead create a new function `ma ```Python hl_lines="2 4" # Code above omitted 👆 -{!./docs_src/tutorial/insert/tutorial002.py[ln:36-38]!} +{!../../docs_src/tutorial/insert/tutorial002.py[ln:36-38]!} # More code here later 👇 ``` @@ -298,7 +298,7 @@ But to keep things a bit more organized, let's instead create a new function `ma 👀 Full file preview ```Python -{!./docs_src/tutorial/insert/tutorial002.py!} +{!../../docs_src/tutorial/insert/tutorial002.py!} ``` @@ -307,14 +307,14 @@ And then we can call that single `main()` function from that main block: ```Python hl_lines="8" # Code above omitted 👆 -{!./docs_src/tutorial/insert/tutorial002.py[ln:36-42]!} +{!../../docs_src/tutorial/insert/tutorial002.py[ln:36-42]!} ```
👀 Full file preview ```Python -{!./docs_src/tutorial/insert/tutorial002.py!} +{!../../docs_src/tutorial/insert/tutorial002.py!} ```
@@ -375,7 +375,7 @@ So once we are done with the session, we should **close** it to make it release ```Python hl_lines="16" # Code above omitted 👆 -{!./docs_src/tutorial/insert/tutorial001.py[ln:23-36]!} +{!../../docs_src/tutorial/insert/tutorial001.py[ln:23-36]!} # More code here later 👇 ``` @@ -384,7 +384,7 @@ So once we are done with the session, we should **close** it to make it release 👀 Full file preview ```Python -{!./docs_src/tutorial/insert/tutorial001.py!} +{!../../docs_src/tutorial/insert/tutorial001.py!} ``` @@ -403,14 +403,14 @@ But there's a better way to handle the session, using a `with` block: ```Python hl_lines="7-12" # Code above omitted 👆 -{!./docs_src/tutorial/insert/tutorial002.py[ln:23-33]!} +{!../../docs_src/tutorial/insert/tutorial002.py[ln:23-33]!} ```
👀 Full file preview ```Python -{!./docs_src/tutorial/insert/tutorial002.py!} +{!../../docs_src/tutorial/insert/tutorial002.py!} ```
@@ -428,10 +428,10 @@ You already know all the first part creating the `Hero` model class, the **engin Let's focus on the new code: ```{.python .annotate } -{!./docs_src/tutorial/insert/tutorial003.py!} +{!../../docs_src/tutorial/insert/tutorial003.py!} ``` -{!./docs_src/tutorial/insert/annotations/en/tutorial003.md!} +{!../../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/en/docs/tutorial/limit-and-offset.md similarity index 90% rename from docs/tutorial/limit-and-offset.md rename to docs/en/docs/tutorial/limit-and-offset.md index 3fb001cf97..d7fd84aa35 100644 --- a/docs/tutorial/limit-and-offset.md +++ b/docs/en/docs/tutorial/limit-and-offset.md @@ -17,7 +17,7 @@ Again, we will create several heroes to have some data to select from: ```Python hl_lines="4-10" # Code above omitted 👆 -{!./docs_src/tutorial/offset_and_limit/tutorial001.py[ln:23-41]!} +{!../../docs_src/tutorial/offset_and_limit/tutorial001.py[ln:23-41]!} # Code below omitted 👇 ``` @@ -26,7 +26,7 @@ Again, we will create several heroes to have some data to select from: 👀 Full file preview ```Python -{!./docs_src/tutorial/offset_and_limit/tutorial001.py!} +{!../../docs_src/tutorial/offset_and_limit/tutorial001.py!} ``` @@ -38,7 +38,7 @@ This is the code we had to select all the heroes in the `select()` examples: ```Python hl_lines="3-8" # Code above omitted 👆 -{!./docs_src/tutorial/select/tutorial003.py[ln:36-41]!} +{!../../docs_src/tutorial/select/tutorial003.py[ln:36-41]!} # Code below omitted 👇 ``` @@ -47,7 +47,7 @@ This is the code we had to select all the heroes in the `select()` examples: 👀 Full file preview ```Python -{!./docs_src/tutorial/select/tutorial003.py!} +{!../../docs_src/tutorial/select/tutorial003.py!} ``` @@ -61,7 +61,7 @@ We currently have 7 heroes in the database. But we could as well have thousands, ```Python hl_lines="5" # Code above omitted 👆 -{!./docs_src/tutorial/offset_and_limit/tutorial001.py[ln:44-49]!} +{!../../docs_src/tutorial/offset_and_limit/tutorial001.py[ln:44-49]!} # Code below omitted 👇 ``` @@ -70,7 +70,7 @@ We currently have 7 heroes in the database. But we could as well have thousands, 👀 Full file preview ```Python -{!./docs_src/tutorial/offset_and_limit/tutorial001.py!} +{!../../docs_src/tutorial/offset_and_limit/tutorial001.py!} ``` @@ -133,7 +133,7 @@ We can use `.offset()`: ```Python hl_lines="5" # Code above omitted 👆 -{!./docs_src/tutorial/offset_and_limit/tutorial002.py[ln:44-49]!} +{!../../docs_src/tutorial/offset_and_limit/tutorial002.py[ln:44-49]!} # Code below omitted 👇 ``` @@ -142,7 +142,7 @@ We can use `.offset()`: 👀 Full file preview ```Python -{!./docs_src/tutorial/offset_and_limit/tutorial002.py!} +{!../../docs_src/tutorial/offset_and_limit/tutorial002.py!} ``` @@ -187,7 +187,7 @@ Then to get the next batch of 3 rows we would offset all the ones we already saw ```Python hl_lines="5" # Code above omitted 👆 -{!./docs_src/tutorial/offset_and_limit/tutorial003.py[ln:44-49]!} +{!../../docs_src/tutorial/offset_and_limit/tutorial003.py[ln:44-49]!} # Code below omitted 👇 ``` @@ -196,7 +196,7 @@ Then to get the next batch of 3 rows we would offset all the ones we already saw 👀 Full file preview ```Python -{!./docs_src/tutorial/offset_and_limit/tutorial003.py!} +{!../../docs_src/tutorial/offset_and_limit/tutorial003.py!} ``` @@ -257,7 +257,7 @@ Of course, you can also combine `.limit()` and `.offset()` with `.where()` and o ```Python hl_lines="5" # Code above omitted 👆 -{!./docs_src/tutorial/offset_and_limit/tutorial004.py[ln:44-49]!} +{!../../docs_src/tutorial/offset_and_limit/tutorial004.py[ln:44-49]!} # Code below omitted 👇 ``` @@ -266,7 +266,7 @@ Of course, you can also combine `.limit()` and `.offset()` with `.where()` and o 👀 Full file preview ```Python -{!./docs_src/tutorial/offset_and_limit/tutorial004.py!} +{!../../docs_src/tutorial/offset_and_limit/tutorial004.py!} ``` diff --git a/docs/tutorial/many-to-many/create-data.md b/docs/en/docs/tutorial/many-to-many/create-data.md similarity index 92% rename from docs/tutorial/many-to-many/create-data.md rename to docs/en/docs/tutorial/many-to-many/create-data.md index 22afb7ce7e..56461d6900 100644 --- a/docs/tutorial/many-to-many/create-data.md +++ b/docs/en/docs/tutorial/many-to-many/create-data.md @@ -12,7 +12,7 @@ We'll continue from where we left off with the previous code. 👀 Full file preview ```Python -{!./docs_src/tutorial/many_to_many/tutorial001.py!} +{!../../docs_src/tutorial/many_to_many/tutorial001.py!} ``` @@ -24,7 +24,7 @@ As we have done before, we'll create a function `create_heroes()` and we'll crea ```Python hl_lines="11" # Code above omitted 👆 -{!./docs_src/tutorial/many_to_many/tutorial001.py[ln:42-60]!} +{!../../docs_src/tutorial/many_to_many/tutorial001.py[ln:42-60]!} # Code below omitted 👇 ``` @@ -33,7 +33,7 @@ As we have done before, we'll create a function `create_heroes()` and we'll crea 👀 Full file preview ```Python -{!./docs_src/tutorial/many_to_many/tutorial001.py!} +{!../../docs_src/tutorial/many_to_many/tutorial001.py!} ``` @@ -53,7 +53,7 @@ Now let's do as we have done before, `commit` the **session**, `refresh` the dat ```Python hl_lines="22-25 27-29 31-36" # Code above omitted 👆 -{!./docs_src/tutorial/many_to_many/tutorial001.py[ln:42-75]!} +{!../../docs_src/tutorial/many_to_many/tutorial001.py[ln:42-75]!} # Code below omitted 👇 ``` @@ -62,7 +62,7 @@ Now let's do as we have done before, `commit` the **session**, `refresh` the dat 👀 Full file preview ```Python -{!./docs_src/tutorial/many_to_many/tutorial001.py!} +{!../../docs_src/tutorial/many_to_many/tutorial001.py!} ``` @@ -74,7 +74,7 @@ As before, add the `create_heroes()` function to the `main()` function to make s ```Python hl_lines="22-25 27-29 31-36" # Code above omitted 👆 -{!./docs_src/tutorial/many_to_many/tutorial001.py[ln:78-80]!} +{!../../docs_src/tutorial/many_to_many/tutorial001.py[ln:78-80]!} # Code below omitted 👇 ``` @@ -83,7 +83,7 @@ As before, add the `create_heroes()` function to the `main()` function to make s 👀 Full file preview ```Python -{!./docs_src/tutorial/many_to_many/tutorial001.py!} +{!../../docs_src/tutorial/many_to_many/tutorial001.py!} ``` diff --git a/docs/tutorial/many-to-many/create-models-with-link.md b/docs/en/docs/tutorial/many-to-many/create-models-with-link.md similarity index 86% rename from docs/tutorial/many-to-many/create-models-with-link.md rename to docs/en/docs/tutorial/many-to-many/create-models-with-link.md index bc4481f73d..a85874575a 100644 --- a/docs/tutorial/many-to-many/create-models-with-link.md +++ b/docs/en/docs/tutorial/many-to-many/create-models-with-link.md @@ -13,7 +13,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**: ```Python hl_lines="6-12" -{!./docs_src/tutorial/many_to_many/tutorial001.py[ln:1-12]!} +{!../../docs_src/tutorial/many_to_many/tutorial001.py[ln:1-12]!} # Code below omitted 👇 ``` @@ -22,7 +22,7 @@ We can create it just as any other **SQLModel**: 👀 Full file preview ```Python -{!./docs_src/tutorial/many_to_many/tutorial001.py!} +{!../../docs_src/tutorial/many_to_many/tutorial001.py!} ``` @@ -42,7 +42,7 @@ Let's see the `Team` model, it's almost identical as before, but with a little c ```Python hl_lines="8" # Code above omitted 👆 -{!./docs_src/tutorial/many_to_many/tutorial001.py[ln:15-20]!} +{!../../docs_src/tutorial/many_to_many/tutorial001.py[ln:15-20]!} # Code below omitted 👇 ``` @@ -51,7 +51,7 @@ Let's see the `Team` model, it's almost identical as before, but with a little c 👀 Full file preview ```Python -{!./docs_src/tutorial/many_to_many/tutorial001.py!} +{!../../docs_src/tutorial/many_to_many/tutorial001.py!} ``` @@ -71,7 +71,7 @@ Let's see the other side, here's the `Hero` model: ```Python hl_lines="9" # Code above omitted 👆 -{!./docs_src/tutorial/many_to_many/tutorial001.py[ln:23-29]!} +{!../../docs_src/tutorial/many_to_many/tutorial001.py[ln:23-29]!} # Code below omitted 👇 ``` @@ -80,7 +80,7 @@ Let's see the other side, here's the `Hero` model: 👀 Full file preview ```Python -{!./docs_src/tutorial/many_to_many/tutorial001.py!} +{!../../docs_src/tutorial/many_to_many/tutorial001.py!} ``` @@ -104,7 +104,7 @@ The same as before, we will have the rest of the code to create the **engine**, ```Python hl_lines="9" # Code above omitted 👆 -{!./docs_src/tutorial/many_to_many/tutorial001.py[ln:32-39]!} +{!../../docs_src/tutorial/many_to_many/tutorial001.py[ln:32-39]!} # Code below omitted 👇 ``` @@ -113,7 +113,7 @@ The same as before, we will have the rest of the code to create the **engine**, 👀 Full file preview ```Python -{!./docs_src/tutorial/many_to_many/tutorial001.py!} +{!../../docs_src/tutorial/many_to_many/tutorial001.py!} ``` @@ -124,17 +124,17 @@ And as in previous examples, we will add that function to a function `main()`, a ```Python hl_lines="4" # Code above omitted 👆 -{!./docs_src/tutorial/many_to_many/tutorial001.py[ln:78-79]!} +{!../../docs_src/tutorial/many_to_many/tutorial001.py[ln:78-79]!} # We will do more stuff here later 👈 -{!./docs_src/tutorial/many_to_many/tutorial001.py[ln:83-84]!} +{!../../docs_src/tutorial/many_to_many/tutorial001.py[ln:83-84]!} ```
👀 Full file preview ```Python -{!./docs_src/tutorial/many_to_many/tutorial001.py!} +{!../../docs_src/tutorial/many_to_many/tutorial001.py!} ```
diff --git a/docs/tutorial/many-to-many/index.md b/docs/en/docs/tutorial/many-to-many/index.md similarity index 100% rename from docs/tutorial/many-to-many/index.md rename to docs/en/docs/tutorial/many-to-many/index.md diff --git a/docs/tutorial/many-to-many/link-with-extra-fields.md b/docs/en/docs/tutorial/many-to-many/link-with-extra-fields.md similarity index 94% rename from docs/tutorial/many-to-many/link-with-extra-fields.md rename to docs/en/docs/tutorial/many-to-many/link-with-extra-fields.md index 9c3309da91..168062d0fd 100644 --- a/docs/tutorial/many-to-many/link-with-extra-fields.md +++ b/docs/en/docs/tutorial/many-to-many/link-with-extra-fields.md @@ -32,7 +32,7 @@ And we will also add two **relationship attributes**, for the linked `team` and ```Python hl_lines="10 12-13" # Code above omitted 👆 -{!./docs_src/tutorial/many_to_many/tutorial003.py[ln:6-16]!} +{!../../docs_src/tutorial/many_to_many/tutorial003.py[ln:6-16]!} # Code below omitted 👇 ``` @@ -41,7 +41,7 @@ And we will also add two **relationship attributes**, for the linked `team` and 👀 Full file preview ```Python -{!./docs_src/tutorial/many_to_many/tutorial003.py!} +{!../../docs_src/tutorial/many_to_many/tutorial003.py!} ``` @@ -65,7 +65,7 @@ We no longer have the `heroes` relationship attribute, and instead we have the n ```Python hl_lines="8" # Code above omitted 👆 -{!./docs_src/tutorial/many_to_many/tutorial003.py[ln:19-24]!} +{!../../docs_src/tutorial/many_to_many/tutorial003.py[ln:19-24]!} # Code below omitted 👇 ``` @@ -74,7 +74,7 @@ We no longer have the `heroes` relationship attribute, and instead we have the n 👀 Full file preview ```Python -{!./docs_src/tutorial/many_to_many/tutorial003.py!} +{!../../docs_src/tutorial/many_to_many/tutorial003.py!} ``` @@ -88,7 +88,7 @@ We change the `teams` relationship attribute for `team_links`: ```Python hl_lines="9" # Code above omitted 👆 -{!./docs_src/tutorial/many_to_many/tutorial003.py[ln:27-33]!} +{!../../docs_src/tutorial/many_to_many/tutorial003.py[ln:27-33]!} # Code below omitted 👇 ``` @@ -97,7 +97,7 @@ We change the `teams` relationship attribute for `team_links`: 👀 Full file preview ```Python -{!./docs_src/tutorial/many_to_many/tutorial003.py!} +{!../../docs_src/tutorial/many_to_many/tutorial003.py!} ``` @@ -111,7 +111,7 @@ But now we create the **explicit link models** manually, pointing to their hero ```Python hl_lines="21-30 32-35" # Code above omitted 👆 -{!./docs_src/tutorial/many_to_many/tutorial003.py[ln:46-85]!} +{!../../docs_src/tutorial/many_to_many/tutorial003.py[ln:46-85]!} # Code below omitted 👇 ``` @@ -120,7 +120,7 @@ But now we create the **explicit link models** manually, pointing to their hero 👀 Full file preview ```Python -{!./docs_src/tutorial/many_to_many/tutorial003.py!} +{!../../docs_src/tutorial/many_to_many/tutorial003.py!} ``` @@ -224,7 +224,7 @@ Here we do that in the `update_heroes()` function: ```Python hl_lines="10-15" # Code above omitted 👆 -{!./docs_src/tutorial/many_to_many/tutorial003.py[ln:88-103]!} +{!../../docs_src/tutorial/many_to_many/tutorial003.py[ln:88-103]!} # Code below omitted 👇 ``` @@ -233,7 +233,7 @@ Here we do that in the `update_heroes()` function: 👀 Full file preview ```Python -{!./docs_src/tutorial/many_to_many/tutorial003.py!} +{!../../docs_src/tutorial/many_to_many/tutorial003.py!} ``` @@ -320,11 +320,11 @@ We can do that by iterating on the links: ```Python hl_lines="8-10" # Code above omitted 👆 -{!./docs_src/tutorial/many_to_many/tutorial003.py[ln:88-89]!} +{!../../docs_src/tutorial/many_to_many/tutorial003.py[ln:88-89]!} # Code here omitted 👈 -{!./docs_src/tutorial/many_to_many/tutorial003.py[ln:105-113]!} +{!../../docs_src/tutorial/many_to_many/tutorial003.py[ln:105-113]!} # Code below omitted 👇 ``` @@ -333,7 +333,7 @@ We can do that by iterating on the links: 👀 Full file preview ```Python -{!./docs_src/tutorial/many_to_many/tutorial003.py!} +{!../../docs_src/tutorial/many_to_many/tutorial003.py!} ``` diff --git a/docs/tutorial/many-to-many/update-remove-relationships.md b/docs/en/docs/tutorial/many-to-many/update-remove-relationships.md similarity index 92% rename from docs/tutorial/many-to-many/update-remove-relationships.md rename to docs/en/docs/tutorial/many-to-many/update-remove-relationships.md index 5cc55e1f41..050da698b7 100644 --- a/docs/tutorial/many-to-many/update-remove-relationships.md +++ b/docs/en/docs/tutorial/many-to-many/update-remove-relationships.md @@ -8,7 +8,7 @@ We'll continue from where we left off with the previous code. 👀 Full file preview ```Python -{!./docs_src/tutorial/many_to_many/tutorial001.py!} +{!../../docs_src/tutorial/many_to_many/tutorial001.py!} ``` @@ -24,11 +24,11 @@ As you already know how these goes, I'll use the **short version** and get the d And because we are now using `select()`, we also have to import it. ```Python hl_lines="3 7-12" -{!./docs_src/tutorial/many_to_many/tutorial002.py[ln:1-3]!} +{!../../docs_src/tutorial/many_to_many/tutorial002.py[ln:1-3]!} # Some code here omitted 👈 -{!./docs_src/tutorial/many_to_many/tutorial002.py[ln:78-83]!} +{!../../docs_src/tutorial/many_to_many/tutorial002.py[ln:78-83]!} # Code below omitted 👇 ``` @@ -37,7 +37,7 @@ And because we are now using `select()`, we also have to import it. 👀 Full file preview ```Python -{!./docs_src/tutorial/many_to_many/tutorial002.py!} +{!../../docs_src/tutorial/many_to_many/tutorial002.py!} ``` @@ -47,14 +47,14 @@ And of course, we have to add `update_heroes()` to our `main()` function: ```Python hl_lines="6" # Code above omitted 👆 -{!./docs_src/tutorial/many_to_many/tutorial002.py[ln:100-107]!} +{!../../docs_src/tutorial/many_to_many/tutorial002.py[ln:100-107]!} ```
👀 Full file preview ```Python -{!./docs_src/tutorial/many_to_many/tutorial002.py!} +{!../../docs_src/tutorial/many_to_many/tutorial002.py!} ```
@@ -68,7 +68,7 @@ We can use the same **relationship attributes** to include `hero_spider_boy` in ```Python hl_lines="10-12 14-15" # Code above omitted 👆 -{!./docs_src/tutorial/many_to_many/tutorial002.py[ln:78-90]!} +{!../../docs_src/tutorial/many_to_many/tutorial002.py[ln:78-90]!} # Code below omitted 👇 ``` @@ -77,7 +77,7 @@ We can use the same **relationship attributes** to include `hero_spider_boy` in 👀 Full file preview ```Python -{!./docs_src/tutorial/many_to_many/tutorial002.py!} +{!../../docs_src/tutorial/many_to_many/tutorial002.py!} ``` @@ -165,7 +165,7 @@ In this case, we use the method `.remove()`, that takes an item and removes it f ```Python hl_lines="17-19 21-22" # Code above omitted 👆 -{!./docs_src/tutorial/many_to_many/tutorial002.py[ln:78-97]!} +{!../../docs_src/tutorial/many_to_many/tutorial002.py[ln:78-97]!} # Code below omitted 👇 ``` @@ -174,7 +174,7 @@ In this case, we use the method `.remove()`, that takes an item and removes it f 👀 Full file preview ```Python -{!./docs_src/tutorial/many_to_many/tutorial002.py!} +{!../../docs_src/tutorial/many_to_many/tutorial002.py!} ``` diff --git a/docs/tutorial/one.md b/docs/en/docs/tutorial/one.md similarity index 88% rename from docs/tutorial/one.md rename to docs/en/docs/tutorial/one.md index 3b60653ed9..506101610d 100644 --- a/docs/tutorial/one.md +++ b/docs/en/docs/tutorial/one.md @@ -18,7 +18,7 @@ We'll continue with the same examples we have been using in the previous chapter 👀 Full file preview ```Python -{!./docs_src/tutorial/indexes/tutorial002.py!} +{!../../docs_src/tutorial/indexes/tutorial002.py!} ``` @@ -32,7 +32,7 @@ We have been iterating over the rows in a `result` object like: ```Python hl_lines="7-8" # Code above omitted 👆 -{!./docs_src/tutorial/indexes/tutorial002.py[ln:44-49]!} +{!../../docs_src/tutorial/indexes/tutorial002.py[ln:44-49]!} # Code below omitted 👇 ``` @@ -41,7 +41,7 @@ We have been iterating over the rows in a `result` object like: 👀 Full file preview ```Python -{!./docs_src/tutorial/indexes/tutorial002.py!} +{!../../docs_src/tutorial/indexes/tutorial002.py!} ``` @@ -53,7 +53,7 @@ We can call the `.first()` method on the `results` object to get the first row: ```Python hl_lines="7" # Code above omitted 👆 -{!./docs_src/tutorial/one/tutorial001.py[ln:44-49]!} +{!../../docs_src/tutorial/one/tutorial001.py[ln:44-49]!} # Code below omitted 👇 ``` @@ -62,7 +62,7 @@ We can call the `.first()` method on the `results` object to get the first row: 👀 Full file preview ```Python -{!./docs_src/tutorial/one/tutorial001.py!} +{!../../docs_src/tutorial/one/tutorial001.py!} ``` @@ -106,7 +106,7 @@ In that case, `.first()` will return `None`: ```Python hl_lines="5 7" # Code above omitted 👆 -{!./docs_src/tutorial/one/tutorial002.py[ln:44-49]!} +{!../../docs_src/tutorial/one/tutorial002.py[ln:44-49]!} # Code below omitted 👇 ``` @@ -115,7 +115,7 @@ In that case, `.first()` will return `None`: 👀 Full file preview ```Python -{!./docs_src/tutorial/one/tutorial002.py!} +{!../../docs_src/tutorial/one/tutorial002.py!} ``` @@ -154,7 +154,7 @@ In that case, instead of `.first()` we can use `.one()`: ```Python hl_lines="7" # Code above omitted 👆 -{!./docs_src/tutorial/one/tutorial003.py[ln:44-49]!} +{!../../docs_src/tutorial/one/tutorial003.py[ln:44-49]!} # Code below omitted 👇 ``` @@ -163,7 +163,7 @@ In that case, instead of `.first()` we can use `.one()`: 👀 Full file preview ```Python -{!./docs_src/tutorial/one/tutorial003.py!} +{!../../docs_src/tutorial/one/tutorial003.py!} ``` @@ -225,7 +225,7 @@ Of course, even if we don't duplicate the data, we could get the same error if w ```Python hl_lines="5 7" # Code above omitted 👆 -{!./docs_src/tutorial/one/tutorial004.py[ln:44-49]!} +{!../../docs_src/tutorial/one/tutorial004.py[ln:44-49]!} # Code below omitted 👇 ``` @@ -234,7 +234,7 @@ Of course, even if we don't duplicate the data, we could get the same error if w 👀 Full file preview ```Python -{!./docs_src/tutorial/one/tutorial004.py!} +{!../../docs_src/tutorial/one/tutorial004.py!} ``` @@ -248,7 +248,7 @@ And also, if we get no rows at all with `.one()`, it will also raise an error: ```Python hl_lines="5 7" # Code above omitted 👆 -{!./docs_src/tutorial/one/tutorial005.py[ln:44-49]!} +{!../../docs_src/tutorial/one/tutorial005.py[ln:44-49]!} # Code below omitted 👇 ``` @@ -257,7 +257,7 @@ And also, if we get no rows at all with `.one()`, it will also raise an error: 👀 Full file preview ```Python -{!./docs_src/tutorial/one/tutorial005.py!} +{!../../docs_src/tutorial/one/tutorial005.py!} ``` @@ -296,7 +296,7 @@ Of course, with `.first()` and `.one()` you would also probably write all that i ```Python hl_lines="5" # Code above omitted 👆 -{!./docs_src/tutorial/one/tutorial006.py[ln:44-47]!} +{!../../docs_src/tutorial/one/tutorial006.py[ln:44-47]!} # Code below omitted 👇 ``` @@ -305,7 +305,7 @@ Of course, with `.first()` and `.one()` you would also probably write all that i 👀 Full file preview ```Python -{!./docs_src/tutorial/one/tutorial006.py!} +{!../../docs_src/tutorial/one/tutorial006.py!} ``` @@ -321,7 +321,7 @@ You could do it the same way we have been doing with a `.where()` and then getti ```Python hl_lines="5 7" # Code above omitted 👆 -{!./docs_src/tutorial/one/tutorial007.py[ln:44-49]!} +{!../../docs_src/tutorial/one/tutorial007.py[ln:44-49]!} # Code below omitted 👇 ``` @@ -330,7 +330,7 @@ You could do it the same way we have been doing with a `.where()` and then getti 👀 Full file preview ```Python -{!./docs_src/tutorial/one/tutorial007.py!} +{!../../docs_src/tutorial/one/tutorial007.py!} ``` @@ -344,7 +344,7 @@ As selecting a single row by its Id column with the **primary key** is a common ```Python hl_lines="5" # Code above omitted 👆 -{!./docs_src/tutorial/one/tutorial008.py[ln:44-47]!} +{!../../docs_src/tutorial/one/tutorial008.py[ln:44-47]!} # Code below omitted 👇 ``` @@ -353,7 +353,7 @@ As selecting a single row by its Id column with the **primary key** is a common 👀 Full file preview ```Python -{!./docs_src/tutorial/one/tutorial008.py!} +{!../../docs_src/tutorial/one/tutorial008.py!} ``` @@ -388,7 +388,7 @@ Hero: secret_name='Dive Wilson' age=None id=1 name='Deadpond' ```Python hl_lines="5" # Code above omitted 👆 -{!./docs_src/tutorial/one/tutorial009.py[ln:44-47]!} +{!../../docs_src/tutorial/one/tutorial009.py[ln:44-47]!} # Code below omitted 👇 ``` @@ -397,7 +397,7 @@ Hero: secret_name='Dive Wilson' age=None id=1 name='Deadpond' 👀 Full file preview ```Python -{!./docs_src/tutorial/one/tutorial009.py!} +{!../../docs_src/tutorial/one/tutorial009.py!} ``` diff --git a/docs/tutorial/relationship-attributes/back-populates.md b/docs/en/docs/tutorial/relationship-attributes/back-populates.md similarity index 81% rename from docs/tutorial/relationship-attributes/back-populates.md rename to docs/en/docs/tutorial/relationship-attributes/back-populates.md index 86a4c2a70a..9344edd88e 100644 --- a/docs/tutorial/relationship-attributes/back-populates.md +++ b/docs/en/docs/tutorial/relationship-attributes/back-populates.md @@ -21,7 +21,7 @@ Let's understand that better with an example. Let's see how that works by writing an **incomplete** version first, without `back_populates`: ```Python hl_lines="11 21" -{!./docs_src/tutorial/relationship_attributes/back_populates/tutorial001.py[ln:1-21]!} +{!../../docs_src/tutorial/relationship_attributes/back_populates/tutorial001.py[ln:1-21]!} # Code below omitted 👇 ``` @@ -30,7 +30,7 @@ Let's see how that works by writing an **incomplete** version first, without `ba 👀 Full file preview ```Python -{!./docs_src/tutorial/relationship_attributes/back_populates/tutorial001.py!} +{!../../docs_src/tutorial/relationship_attributes/back_populates/tutorial001.py!} ``` @@ -44,7 +44,7 @@ As you already know how this works, I won't separate that in a select `statement ```Python hl_lines="5-7 9-11" # Code above omitted 👆 -{!./docs_src/tutorial/relationship_attributes/back_populates/tutorial001.py[ln:105-113]!} +{!../../docs_src/tutorial/relationship_attributes/back_populates/tutorial001.py[ln:105-113]!} # Code below omitted 👇 ``` @@ -53,7 +53,7 @@ As you already know how this works, I won't separate that in a select `statement 👀 Full file preview ```Python -{!./docs_src/tutorial/relationship_attributes/back_populates/tutorial001.py!} +{!../../docs_src/tutorial/relationship_attributes/back_populates/tutorial001.py!} ``` @@ -68,7 +68,7 @@ Now, let's print the current **Spider-Boy**, the current **Preventers** team, an ```Python hl_lines="13-15" # Code above omitted 👆 -{!./docs_src/tutorial/relationship_attributes/back_populates/tutorial001.py[ln:105-117]!} +{!../../docs_src/tutorial/relationship_attributes/back_populates/tutorial001.py[ln:105-117]!} # Code below omitted 👇 ``` @@ -77,7 +77,7 @@ Now, let's print the current **Spider-Boy**, the current **Preventers** team, an 👀 Full file preview ```Python -{!./docs_src/tutorial/relationship_attributes/back_populates/tutorial001.py!} +{!../../docs_src/tutorial/relationship_attributes/back_populates/tutorial001.py!} ``` @@ -105,11 +105,11 @@ Now let's update **Spider-Boy**, removing him from the team by setting `hero_spi ```Python hl_lines="8 12" # Code above omitted 👆 -{!./docs_src/tutorial/relationship_attributes/back_populates/tutorial001.py[ln:105-106]!} +{!../../docs_src/tutorial/relationship_attributes/back_populates/tutorial001.py[ln:105-106]!} # Code here omitted 👈 -{!./docs_src/tutorial/relationship_attributes/back_populates/tutorial001.py[ln:119-123]!} +{!../../docs_src/tutorial/relationship_attributes/back_populates/tutorial001.py[ln:119-123]!} # Code below omitted 👇 ``` @@ -118,7 +118,7 @@ Now let's update **Spider-Boy**, removing him from the team by setting `hero_spi 👀 Full file preview ```Python -{!./docs_src/tutorial/relationship_attributes/back_populates/tutorial001.py!} +{!../../docs_src/tutorial/relationship_attributes/back_populates/tutorial001.py!} ``` @@ -161,11 +161,11 @@ Now, if we commit it and print again: ```Python hl_lines="8-9 15" # Code above omitted 👆 -{!./docs_src/tutorial/relationship_attributes/back_populates/tutorial001.py[ln:105-106]!} +{!../../docs_src/tutorial/relationship_attributes/back_populates/tutorial001.py[ln:105-106]!} # Code here omitted 👈 -{!./docs_src/tutorial/relationship_attributes/back_populates/tutorial001.py[ln:125-132]!} +{!../../docs_src/tutorial/relationship_attributes/back_populates/tutorial001.py[ln:125-132]!} # Code below omitted 👇 ``` @@ -174,7 +174,7 @@ Now, if we commit it and print again: 👀 Full file preview ```Python -{!./docs_src/tutorial/relationship_attributes/back_populates/tutorial001.py!} +{!../../docs_src/tutorial/relationship_attributes/back_populates/tutorial001.py!} ``` @@ -210,7 +210,7 @@ That's what `back_populates` is for. ✨ Let's add it back: ```Python hl_lines="11 21" -{!./docs_src/tutorial/relationship_attributes/back_populates/tutorial002.py[ln:1-21]!} +{!../../docs_src/tutorial/relationship_attributes/back_populates/tutorial002.py[ln:1-21]!} # Code below omitted 👇 ``` @@ -219,7 +219,7 @@ Let's add it back: 👀 Full file preview ```Python -{!./docs_src/tutorial/relationship_attributes/back_populates/tutorial002.py!} +{!../../docs_src/tutorial/relationship_attributes/back_populates/tutorial002.py!} ``` @@ -229,11 +229,11 @@ And we can keep the rest of the code the same: ```Python hl_lines="8 12" # Code above omitted 👆 -{!./docs_src/tutorial/relationship_attributes/back_populates/tutorial002.py[ln:105-106]!} +{!../../docs_src/tutorial/relationship_attributes/back_populates/tutorial002.py[ln:105-106]!} # Code here omitted 👈 -{!./docs_src/tutorial/relationship_attributes/back_populates/tutorial002.py[ln:119-123]!} +{!../../docs_src/tutorial/relationship_attributes/back_populates/tutorial002.py[ln:119-123]!} # Code below omitted 👇 ``` @@ -242,7 +242,7 @@ And we can keep the rest of the code the same: 👀 Full file preview ```Python -{!./docs_src/tutorial/relationship_attributes/back_populates/tutorial002.py!} +{!../../docs_src/tutorial/relationship_attributes/back_populates/tutorial002.py!} ``` @@ -276,7 +276,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: ```Python hl_lines="11 21" -{!./docs_src/tutorial/relationship_attributes/back_populates/tutorial002.py[ln:1-21]!} +{!../../docs_src/tutorial/relationship_attributes/back_populates/tutorial002.py[ln:1-21]!} # Code below omitted 👇 ``` @@ -285,7 +285,7 @@ It's quite simple code, it's just a string, but it might be confusing to think e 👀 Full file preview ```Python -{!./docs_src/tutorial/relationship_attributes/back_populates/tutorial002.py!} +{!../../docs_src/tutorial/relationship_attributes/back_populates/tutorial002.py!} ``` @@ -299,7 +299,7 @@ So, in the class `Team`, we have an attribute `heroes` and we declare it with `R ```Python hl_lines="8" # Code above omitted 👆 -{!./docs_src/tutorial/relationship_attributes/back_populates/tutorial002.py[ln:6-11]!} +{!../../docs_src/tutorial/relationship_attributes/back_populates/tutorial002.py[ln:6-11]!} # Code below omitted 👇 ``` @@ -308,7 +308,7 @@ So, in the class `Team`, we have an attribute `heroes` and we declare it with `R 👀 Full file preview ```Python -{!./docs_src/tutorial/relationship_attributes/back_populates/tutorial002.py!} +{!../../docs_src/tutorial/relationship_attributes/back_populates/tutorial002.py!} ``` @@ -322,7 +322,7 @@ So, the string `"heroes"` refers to the attribute `heroes` in the class `Team`. ```Python hl_lines="10" # Code above omitted 👆 -{!./docs_src/tutorial/relationship_attributes/back_populates/tutorial002.py[ln:14-21]!} +{!../../docs_src/tutorial/relationship_attributes/back_populates/tutorial002.py[ln:14-21]!} # Code below omitted 👇 ``` @@ -331,7 +331,7 @@ So, the string `"heroes"` refers to the attribute `heroes` in the class `Team`. 👀 Full file preview ```Python -{!./docs_src/tutorial/relationship_attributes/back_populates/tutorial002.py!} +{!../../docs_src/tutorial/relationship_attributes/back_populates/tutorial002.py!} ``` @@ -359,7 +359,7 @@ So, `back_populates` would most probably be something like `"hero"` or `"heroes" ```Python hl_lines="3 10 13 15" # Code above omitted 👆 -{!./docs_src/tutorial/relationship_attributes/back_populates/tutorial003.py[ln:29-41]!} +{!../../docs_src/tutorial/relationship_attributes/back_populates/tutorial003.py[ln:29-41]!} # Code below omitted 👇 ``` @@ -368,7 +368,7 @@ So, `back_populates` would most probably be something like `"hero"` or `"heroes" 👀 Full file preview ```Python -{!./docs_src/tutorial/relationship_attributes/back_populates/tutorial003.py!} +{!../../docs_src/tutorial/relationship_attributes/back_populates/tutorial003.py!} ``` diff --git a/docs/tutorial/relationship-attributes/create-and-update-relationships.md b/docs/en/docs/tutorial/relationship-attributes/create-and-update-relationships.md similarity index 79% rename from docs/tutorial/relationship-attributes/create-and-update-relationships.md rename to docs/en/docs/tutorial/relationship-attributes/create-and-update-relationships.md index dc05af6eb6..de102dccdb 100644 --- a/docs/tutorial/relationship-attributes/create-and-update-relationships.md +++ b/docs/en/docs/tutorial/relationship-attributes/create-and-update-relationships.md @@ -9,7 +9,7 @@ Let's check the old code we used to create some heroes and teams: ```Python hl_lines="9 12 18 24" # Code above omitted 👆 -{!./docs_src/tutorial/connect/insert/tutorial001.py[ln:31-60]!} +{!../../docs_src/tutorial/connect/insert/tutorial001.py[ln:31-60]!} # Code below omitted 👇 ``` @@ -18,7 +18,7 @@ Let's check the old code we used to create some heroes and teams: 👀 Full file preview ```Python -{!./docs_src/tutorial/connect/insert/tutorial001.py!} +{!../../docs_src/tutorial/connect/insert/tutorial001.py!} ``` @@ -44,7 +44,7 @@ Now let's do all that, but this time using the new, shiny `Relationship` attribu ```Python hl_lines="9 12 18" # Code above omitted 👆 -{!./docs_src/tutorial/relationship_attributes/define_relationship_attributes/tutorial001.py[ln:34-57]!} +{!../../docs_src/tutorial/relationship_attributes/define_relationship_attributes/tutorial001.py[ln:34-57]!} # Code below omitted 👇 ``` @@ -53,7 +53,7 @@ Now let's do all that, but this time using the new, shiny `Relationship` attribu 👀 Full file preview ```Python -{!./docs_src/tutorial/relationship_attributes/define_relationship_attributes/tutorial001.py!} +{!../../docs_src/tutorial/relationship_attributes/define_relationship_attributes/tutorial001.py!} ``` @@ -75,11 +75,11 @@ The same way we could assign an integer with a `team.id` to a `hero.team_id`, we ```Python hl_lines="8" # Code above omitted 👆 -{!./docs_src/tutorial/relationship_attributes/create_and_update_relationships/tutorial001.py[ln:34-35]!} +{!../../docs_src/tutorial/relationship_attributes/create_and_update_relationships/tutorial001.py[ln:34-35]!} # Previous code here omitted 👈 -{!./docs_src/tutorial/relationship_attributes/create_and_update_relationships/tutorial001.py[ln:59-63]!} +{!../../docs_src/tutorial/relationship_attributes/create_and_update_relationships/tutorial001.py[ln:59-63]!} # Code below omitted 👇 ``` @@ -88,7 +88,7 @@ The same way we could assign an integer with a `team.id` to a `hero.team_id`, we 👀 Full file preview ```Python -{!./docs_src/tutorial/relationship_attributes/create_and_update_relationships/tutorial001.py!} +{!../../docs_src/tutorial/relationship_attributes/create_and_update_relationships/tutorial001.py!} ``` @@ -102,11 +102,11 @@ We could also create the `Hero` instances first, and then pass them in the `hero ```Python hl_lines="13 15-16" # Code above omitted 👆 -{!./docs_src/tutorial/relationship_attributes/create_and_update_relationships/tutorial001.py[ln:34-35]!} +{!../../docs_src/tutorial/relationship_attributes/create_and_update_relationships/tutorial001.py[ln:34-35]!} # Previous code here omitted 👈 -{!./docs_src/tutorial/relationship_attributes/create_and_update_relationships/tutorial001.py[ln:65-75]!} +{!../../docs_src/tutorial/relationship_attributes/create_and_update_relationships/tutorial001.py[ln:65-75]!} # Code below omitted 👇 ``` @@ -115,7 +115,7 @@ We could also create the `Hero` instances first, and then pass them in the `hero 👀 Full file preview ```Python -{!./docs_src/tutorial/relationship_attributes/create_and_update_relationships/tutorial001.py!} +{!../../docs_src/tutorial/relationship_attributes/create_and_update_relationships/tutorial001.py!} ``` @@ -137,11 +137,11 @@ Let's create some more heroes and add them to the `team_preventers.heroes` list ```Python hl_lines="14-18" # Code above omitted 👆 -{!./docs_src/tutorial/relationship_attributes/create_and_update_relationships/tutorial001.py[ln:34-35]!} +{!../../docs_src/tutorial/relationship_attributes/create_and_update_relationships/tutorial001.py[ln:34-35]!} # Previous code here omitted 👈 -{!./docs_src/tutorial/relationship_attributes/create_and_update_relationships/tutorial001.py[ln:77-93]!} +{!../../docs_src/tutorial/relationship_attributes/create_and_update_relationships/tutorial001.py[ln:77-93]!} # Code below omitted 👇 ``` @@ -150,7 +150,7 @@ Let's create some more heroes and add them to the `team_preventers.heroes` list 👀 Full file preview ```Python -{!./docs_src/tutorial/relationship_attributes/create_and_update_relationships/tutorial001.py!} +{!../../docs_src/tutorial/relationship_attributes/create_and_update_relationships/tutorial001.py!} ``` diff --git a/docs/tutorial/relationship-attributes/define-relationships-attributes.md b/docs/en/docs/tutorial/relationship-attributes/define-relationships-attributes.md similarity index 87% rename from docs/tutorial/relationship-attributes/define-relationships-attributes.md rename to docs/en/docs/tutorial/relationship-attributes/define-relationships-attributes.md index 0531ec53e5..b94d4255c7 100644 --- a/docs/tutorial/relationship-attributes/define-relationships-attributes.md +++ b/docs/en/docs/tutorial/relationship-attributes/define-relationships-attributes.md @@ -42,7 +42,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()`: ```Python hl_lines="18" -{!./docs_src/tutorial/connect/insert/tutorial001.py[ln:1-18]!} +{!../../docs_src/tutorial/connect/insert/tutorial001.py[ln:1-18]!} # Code below omitted 👇 ``` @@ -51,7 +51,7 @@ Up to now, we have only used the `team_id` column to connect the tables when que 👀 Full file preview ```Python -{!./docs_src/tutorial/connect/insert/tutorial001.py!} +{!../../docs_src/tutorial/connect/insert/tutorial001.py!} ``` @@ -63,7 +63,7 @@ But now let's add a couple of new special attributes to these model classes, let First, import `Relationship` from `sqlmodel`: ```Python hl_lines="3" -{!./docs_src/tutorial/relationship_attributes/define_relationship_attributes/tutorial001.py[ln:1-3]!} +{!../../docs_src/tutorial/relationship_attributes/define_relationship_attributes/tutorial001.py[ln:1-3]!} # Code below omitted 👇 ``` @@ -72,7 +72,7 @@ First, import `Relationship` from `sqlmodel`: 👀 Full file preview ```Python -{!./docs_src/tutorial/relationship_attributes/define_relationship_attributes/tutorial001.py!} +{!../../docs_src/tutorial/relationship_attributes/define_relationship_attributes/tutorial001.py!} ``` @@ -80,7 +80,7 @@ First, import `Relationship` from `sqlmodel`: Next, use that `Relationship` to declare a new attribute in the model classes: ```Python hl_lines="11 21" -{!./docs_src/tutorial/relationship_attributes/define_relationship_attributes/tutorial001.py[ln:1-21]!} +{!../../docs_src/tutorial/relationship_attributes/define_relationship_attributes/tutorial001.py[ln:1-21]!} # Code below omitted 👇 ``` @@ -89,7 +89,7 @@ Next, use that `Relationship` to declare a new attribute in the model classes: 👀 Full file preview ```Python -{!./docs_src/tutorial/relationship_attributes/define_relationship_attributes/tutorial001.py!} +{!../../docs_src/tutorial/relationship_attributes/define_relationship_attributes/tutorial001.py!} ``` diff --git a/docs/tutorial/relationship-attributes/index.md b/docs/en/docs/tutorial/relationship-attributes/index.md similarity index 100% rename from docs/tutorial/relationship-attributes/index.md rename to docs/en/docs/tutorial/relationship-attributes/index.md diff --git a/docs/tutorial/relationship-attributes/read-relationships.md b/docs/en/docs/tutorial/relationship-attributes/read-relationships.md similarity index 77% rename from docs/tutorial/relationship-attributes/read-relationships.md rename to docs/en/docs/tutorial/relationship-attributes/read-relationships.md index 181b229589..c1ab7a113b 100644 --- a/docs/tutorial/relationship-attributes/read-relationships.md +++ b/docs/en/docs/tutorial/relationship-attributes/read-relationships.md @@ -9,11 +9,11 @@ First, add a function `select_heroes()` where we get a hero to start working wit ```Python hl_lines="3-7 14" # Code above omitted 👆 -{!./docs_src/tutorial/relationship_attributes/read_relationships/tutorial001.py[ln:96-100]!} +{!../../docs_src/tutorial/relationship_attributes/read_relationships/tutorial001.py[ln:96-100]!} # Previous code here omitted 👈 -{!./docs_src/tutorial/relationship_attributes/read_relationships/tutorial001.py[ln:110-113]!} +{!../../docs_src/tutorial/relationship_attributes/read_relationships/tutorial001.py[ln:110-113]!} # Code below omitted 👇 ``` @@ -22,7 +22,7 @@ First, add a function `select_heroes()` where we get a hero to start working wit 👀 Full file preview ```Python -{!./docs_src/tutorial/relationship_attributes/read_relationships/tutorial001.py!} +{!../../docs_src/tutorial/relationship_attributes/read_relationships/tutorial001.py!} ``` @@ -36,7 +36,7 @@ With what we have learned **up to now**, we could use a `select()` statement, th ```Python hl_lines="9-12" # Code above omitted 👆 -{!./docs_src/tutorial/relationship_attributes/read_relationships/tutorial001.py[ln:96-105]!} +{!../../docs_src/tutorial/relationship_attributes/read_relationships/tutorial001.py[ln:96-105]!} # Code below omitted 👇 ``` @@ -45,7 +45,7 @@ With what we have learned **up to now**, we could use a `select()` statement, th 👀 Full file preview ```Python -{!./docs_src/tutorial/relationship_attributes/read_relationships/tutorial001.py!} +{!../../docs_src/tutorial/relationship_attributes/read_relationships/tutorial001.py!} ``` @@ -59,11 +59,11 @@ So, the highlighted block above, has the same results as the block below: ```Python hl_lines="11" # Code above omitted 👆 -{!./docs_src/tutorial/relationship_attributes/read_relationships/tutorial001.py[ln:96-100]!} +{!../../docs_src/tutorial/relationship_attributes/read_relationships/tutorial001.py[ln:96-100]!} # Code from the previous example omitted 👈 -{!./docs_src/tutorial/relationship_attributes/read_relationships/tutorial001.py[ln:107]!} +{!../../docs_src/tutorial/relationship_attributes/read_relationships/tutorial001.py[ln:107]!} # Code below omitted 👇 ``` @@ -72,7 +72,7 @@ So, the highlighted block above, has the same results as the block below: 👀 Full file preview ```Python -{!./docs_src/tutorial/relationship_attributes/read_relationships/tutorial001.py!} +{!../../docs_src/tutorial/relationship_attributes/read_relationships/tutorial001.py!} ``` @@ -89,7 +89,7 @@ And the same way, when we are working on the **many** side of the **one-to-many* ```Python hl_lines="9" # Code above omitted 👆 -{!./docs_src/tutorial/relationship_attributes/read_relationships/tutorial002.py[ln:96-102]!} +{!../../docs_src/tutorial/relationship_attributes/read_relationships/tutorial002.py[ln:96-102]!} # Code below omitted 👇 ``` @@ -98,7 +98,7 @@ And the same way, when we are working on the **many** side of the **one-to-many* 👀 Full file preview ```Python -{!./docs_src/tutorial/relationship_attributes/read_relationships/tutorial002.py!} +{!../../docs_src/tutorial/relationship_attributes/read_relationships/tutorial002.py!} ``` diff --git a/docs/tutorial/relationship-attributes/remove-relationships.md b/docs/en/docs/tutorial/relationship-attributes/remove-relationships.md similarity index 73% rename from docs/tutorial/relationship-attributes/remove-relationships.md rename to docs/en/docs/tutorial/relationship-attributes/remove-relationships.md index ae4c6cfea2..514acd5579 100644 --- a/docs/tutorial/relationship-attributes/remove-relationships.md +++ b/docs/en/docs/tutorial/relationship-attributes/remove-relationships.md @@ -11,7 +11,7 @@ We can remove the relationship by setting it to `None`, the same as with the `te ```Python hl_lines="9" # Code above omitted 👆 -{!./docs_src/tutorial/relationship_attributes/read_relationships/tutorial002.py[ln:105-116]!} +{!../../docs_src/tutorial/relationship_attributes/read_relationships/tutorial002.py[ln:105-116]!} # Code below omitted 👇 ``` @@ -20,7 +20,7 @@ We can remove the relationship by setting it to `None`, the same as with the `te 👀 Full file preview ```Python -{!./docs_src/tutorial/relationship_attributes/read_relationships/tutorial002.py!} +{!../../docs_src/tutorial/relationship_attributes/read_relationships/tutorial002.py!} ``` @@ -30,7 +30,7 @@ And of course, we should remember to add this `update_heroes()` function to `mai ```Python hl_lines="7" # Code above omitted 👆 -{!./docs_src/tutorial/relationship_attributes/read_relationships/tutorial002.py[ln:119-123]!} +{!../../docs_src/tutorial/relationship_attributes/read_relationships/tutorial002.py[ln:119-123]!} # Code below omitted 👇 ``` @@ -39,7 +39,7 @@ And of course, we should remember to add this `update_heroes()` function to `mai 👀 Full file preview ```Python -{!./docs_src/tutorial/relationship_attributes/read_relationships/tutorial002.py!} +{!../../docs_src/tutorial/relationship_attributes/read_relationships/tutorial002.py!} ``` diff --git a/docs/tutorial/relationship-attributes/type-annotation-strings.md b/docs/en/docs/tutorial/relationship-attributes/type-annotation-strings.md similarity index 85% rename from docs/tutorial/relationship-attributes/type-annotation-strings.md rename to docs/en/docs/tutorial/relationship-attributes/type-annotation-strings.md index da77dad6bb..c024b6b075 100644 --- a/docs/tutorial/relationship-attributes/type-annotation-strings.md +++ b/docs/en/docs/tutorial/relationship-attributes/type-annotation-strings.md @@ -3,7 +3,7 @@ In the first Relationship attribute, we declare it with `List["Hero"]`, putting the `Hero` in quotes instead of just normally there: ```Python hl_lines="11" -{!./docs_src/tutorial/relationship_attributes/define_relationship_attributes/tutorial001.py[ln:1-21]!} +{!../../docs_src/tutorial/relationship_attributes/define_relationship_attributes/tutorial001.py[ln:1-21]!} # Code below omitted 👇 ``` @@ -12,7 +12,7 @@ In the first Relationship attribute, we declare it with `List["Hero"]`, putting 👀 Full file preview ```Python -{!./docs_src/tutorial/relationship_attributes/define_relationship_attributes/tutorial001.py!} +{!../../docs_src/tutorial/relationship_attributes/define_relationship_attributes/tutorial001.py!} ``` diff --git a/docs/tutorial/select.md b/docs/en/docs/tutorial/select.md similarity index 92% rename from docs/tutorial/select.md rename to docs/en/docs/tutorial/select.md index fb638c1212..69dd418d14 100644 --- a/docs/tutorial/select.md +++ b/docs/en/docs/tutorial/select.md @@ -27,7 +27,7 @@ Let's continue from the last code we used to create some data. 👀 Full file preview ```Python -{!./docs_src/tutorial/insert/tutorial002.py!} +{!../../docs_src/tutorial/insert/tutorial002.py!} ``` @@ -167,7 +167,7 @@ We will start with that in a new function `select_heroes()`: ```Python hl_lines="3-4" # Code above omitted 👆 -{!./docs_src/tutorial/select/tutorial001.py[ln:36-37]!} +{!../../docs_src/tutorial/select/tutorial001.py[ln:36-37]!} # More code here later 👇 ``` @@ -176,7 +176,7 @@ We will start with that in a new function `select_heroes()`: 👀 Full file preview ```Python -{!./docs_src/tutorial/select/tutorial001.py!} +{!../../docs_src/tutorial/select/tutorial001.py!} ``` @@ -188,7 +188,7 @@ 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: ```Python hl_lines="3" -{!./docs_src/tutorial/select/tutorial001.py[ln:1-3]!} +{!../../docs_src/tutorial/select/tutorial001.py[ln:1-3]!} # More code below ommitted 👇 ``` @@ -197,7 +197,7 @@ First we have to import `select` from `sqlmodel` at the top of the file: 👀 Full file preview ```Python -{!./docs_src/tutorial/select/tutorial001.py!} +{!../../docs_src/tutorial/select/tutorial001.py!} ``` @@ -205,11 +205,11 @@ First we have to import `select` from `sqlmodel` at the top of the file: And then we will use it to create a `SELECT` statement in Python code: ```Python hl_lines="9" -{!./docs_src/tutorial/select/tutorial001.py[ln:1-3]!} +{!../../docs_src/tutorial/select/tutorial001.py[ln:1-3]!} # More code here omitted 👈 -{!./docs_src/tutorial/select/tutorial001.py[ln:36-38]!} +{!../../docs_src/tutorial/select/tutorial001.py[ln:36-38]!} # More code here later 👇 ``` @@ -218,7 +218,7 @@ And then we will use it to create a `SELECT` statement in Python code: 👀 Full file preview ```Python -{!./docs_src/tutorial/select/tutorial001.py!} +{!../../docs_src/tutorial/select/tutorial001.py!} ``` @@ -252,7 +252,7 @@ Now that we have the `select` statement, we can execute it with the **session**: ```Python hl_lines="6" # Code above omitted 👆 -{!./docs_src/tutorial/select/tutorial001.py[ln:36-39]!} +{!../../docs_src/tutorial/select/tutorial001.py[ln:36-39]!} # More code here later 👇 ``` @@ -261,7 +261,7 @@ Now that we have the `select` statement, we can execute it with the **session**: 👀 Full file preview ```Python -{!./docs_src/tutorial/select/tutorial001.py!} +{!../../docs_src/tutorial/select/tutorial001.py!} ``` @@ -305,7 +305,7 @@ Now we can put it in a `for` loop and print each one of the heroes: ```Python hl_lines="7-8" # Code above omitted 👆 -{!./docs_src/tutorial/select/tutorial001.py[ln:36-41]!} +{!../../docs_src/tutorial/select/tutorial001.py[ln:36-41]!} # Code below omitted 👇 ``` @@ -314,7 +314,7 @@ Now we can put it in a `for` loop and print each one of the heroes: 👀 Full file preview ```Python -{!./docs_src/tutorial/select/tutorial001.py!} +{!../../docs_src/tutorial/select/tutorial001.py!} ``` @@ -334,7 +334,7 @@ Now include a call to `select_heroes()` in the `main()` function so that it is e ```Python hl_lines="14" # Code above omitted 👆 -{!./docs_src/tutorial/select/tutorial001.py[ln:36-47]!} +{!../../docs_src/tutorial/select/tutorial001.py[ln:36-47]!} # More code here later 👇 ``` @@ -343,7 +343,7 @@ Now include a call to `select_heroes()` in the `main()` function so that it is e 👀 Full file preview ```Python -{!./docs_src/tutorial/select/tutorial001.py!} +{!../../docs_src/tutorial/select/tutorial001.py!} ``` @@ -355,10 +355,10 @@ Great, you're now being able to read the data from the database! 🎉 Let's review the code up to this point: ```{ .python .annotate } -{!./docs_src/tutorial/select/tutorial002.py!} +{!../../docs_src/tutorial/select/tutorial002.py!} ``` -{!./docs_src/tutorial/select/annotations/en/tutorial002.md!} +{!../../docs_src/tutorial/select/annotations/en/tutorial002.md!} !!! tip Check out the number bubbles to see what is done by each line of code. @@ -389,7 +389,7 @@ The special `results` object also has a method `results.all()` that returns a li ```Python hl_lines="7" # Code above omitted 👆 -{!./docs_src/tutorial/select/tutorial003.py[ln:36-41]!} +{!../../docs_src/tutorial/select/tutorial003.py[ln:36-41]!} # Code below omitted 👇 ``` @@ -398,7 +398,7 @@ The special `results` object also has a method `results.all()` that returns a li 👀 Full file preview ```Python -{!./docs_src/tutorial/select/tutorial003.py!} +{!../../docs_src/tutorial/select/tutorial003.py!} ``` @@ -427,7 +427,7 @@ But knowing what is each object and what it is all doing, we can simplify it a b ```Python hl_lines="5" # Code above omitted 👆 -{!./docs_src/tutorial/select/tutorial004.py[ln:36-39]!} +{!../../docs_src/tutorial/select/tutorial004.py[ln:36-39]!} # Code below omitted 👇 ``` @@ -436,7 +436,7 @@ But knowing what is each object and what it is all doing, we can simplify it a b 👀 Full file preview ```Python -{!./docs_src/tutorial/select/tutorial004.py!} +{!../../docs_src/tutorial/select/tutorial004.py!} ``` diff --git a/docs/tutorial/update.md b/docs/en/docs/tutorial/update.md similarity index 87% rename from docs/tutorial/update.md rename to docs/en/docs/tutorial/update.md index b3099f5a16..7594c117b1 100644 --- a/docs/tutorial/update.md +++ b/docs/en/docs/tutorial/update.md @@ -10,7 +10,7 @@ As before, we'll continue from where we left off with the previous code. 👀 Full file preview ```Python -{!./docs_src/tutorial/indexes/tutorial002.py!} +{!../../docs_src/tutorial/indexes/tutorial002.py!} ``` @@ -91,7 +91,7 @@ We'll start by selecting the hero `"Spider-Boy"`, this is the one we will update ```Python hl_lines="5" # Code above omitted 👆 -{!./docs_src/tutorial/update/tutorial001.py[ln:44-49]!} +{!../../docs_src/tutorial/update/tutorial001.py[ln:44-49]!} # Code below omitted 👇 ``` @@ -100,7 +100,7 @@ We'll start by selecting the hero `"Spider-Boy"`, this is the one we will update 👀 Full file preview ```Python -{!./docs_src/tutorial/update/tutorial001.py!} +{!../../docs_src/tutorial/update/tutorial001.py!} ``` @@ -110,14 +110,14 @@ Let's not forget to add that `update_heroes()` function to the `main()` function ```Python hl_lines="6" # Code above omitted 👆 -{!./docs_src/tutorial/update/tutorial001.py[ln:58-65]!} +{!../../docs_src/tutorial/update/tutorial001.py[ln:58-65]!} ```
👀 Full file preview ```Python -{!./docs_src/tutorial/update/tutorial001.py!} +{!../../docs_src/tutorial/update/tutorial001.py!} ```
@@ -155,7 +155,7 @@ In this case, we will set the `age` to `16`: ```Python hl_lines="10" # Code above omitted 👆 -{!./docs_src/tutorial/update/tutorial001.py[ln:44-51]!} +{!../../docs_src/tutorial/update/tutorial001.py[ln:44-51]!} # Code below omitted 👇 ``` @@ -164,7 +164,7 @@ In this case, we will set the `age` to `16`: 👀 Full file preview ```Python -{!./docs_src/tutorial/update/tutorial001.py!} +{!../../docs_src/tutorial/update/tutorial001.py!} ``` @@ -178,7 +178,7 @@ This is the same we did when creating new hero instances: ```Python hl_lines="11" # Code above omitted 👆 -{!./docs_src/tutorial/update/tutorial001.py[ln:44-52]!} +{!../../docs_src/tutorial/update/tutorial001.py[ln:44-52]!} # Code below omitted 👇 ``` @@ -187,7 +187,7 @@ This is the same we did when creating new hero instances: 👀 Full file preview ```Python -{!./docs_src/tutorial/update/tutorial001.py!} +{!../../docs_src/tutorial/update/tutorial001.py!} ``` @@ -201,7 +201,7 @@ This will save the updated hero in the database: ```Python hl_lines="12" # Code above omitted 👆 -{!./docs_src/tutorial/update/tutorial001.py[ln:44-53]!} +{!../../docs_src/tutorial/update/tutorial001.py[ln:44-53]!} # Code below omitted 👇 ``` @@ -210,7 +210,7 @@ This will save the updated hero in the database: 👀 Full file preview ```Python -{!./docs_src/tutorial/update/tutorial001.py!} +{!../../docs_src/tutorial/update/tutorial001.py!} ``` @@ -249,7 +249,7 @@ But in this example we are not accessing any attribute, we will only print the o ```Python hl_lines="13" # Code above omitted 👆 -{!./docs_src/tutorial/update/tutorial001.py[ln:44-54]!} +{!../../docs_src/tutorial/update/tutorial001.py[ln:44-54]!} # Code below omitted 👇 ``` @@ -258,7 +258,7 @@ But in this example we are not accessing any attribute, we will only print the o 👀 Full file preview ```Python -{!./docs_src/tutorial/update/tutorial001.py!} +{!../../docs_src/tutorial/update/tutorial001.py!} ``` @@ -290,7 +290,7 @@ Now we can just print the hero: ```Python hl_lines="14" # Code above omitted 👆 -{!./docs_src/tutorial/update/tutorial001.py[ln:44-55]!} +{!../../docs_src/tutorial/update/tutorial001.py[ln:44-55]!} # Code below omitted 👇 ``` @@ -299,7 +299,7 @@ Now we can just print the hero: 👀 Full file preview ```Python -{!./docs_src/tutorial/update/tutorial001.py!} +{!../../docs_src/tutorial/update/tutorial001.py!} ``` @@ -328,10 +328,10 @@ Updated hero: name='Spider-Boy' secret_name='Pedro Parqueador' age=16 id=2 Now let's review all that code: ```{ .python .annotate hl_lines="44-55" } -{!./docs_src/tutorial/update/tutorial002.py!} +{!../../docs_src/tutorial/update/tutorial002.py!} ``` -{!./docs_src/tutorial/update/annotations/en/tutorial002.md!} +{!../../docs_src/tutorial/update/annotations/en/tutorial002.md!} !!! tip Check out the number bubbles to see what is done by each line of code. @@ -345,18 +345,18 @@ This also means that you can update several fields (attributes, columns) at once ```{ .python .annotate hl_lines="15-17 19-21 23" } # Code above omitted 👆 -{!./docs_src/tutorial/update/tutorial004.py[ln:44-70]!} +{!../../docs_src/tutorial/update/tutorial004.py[ln:44-70]!} # Code below omitted 👇 ``` -{!./docs_src/tutorial/update/annotations/en/tutorial004.md!} +{!../../docs_src/tutorial/update/annotations/en/tutorial004.md!}
👀 Full file preview ```Python -{!./docs_src/tutorial/update/tutorial004.py!} +{!../../docs_src/tutorial/update/tutorial004.py!} ```
diff --git a/docs/tutorial/where.md b/docs/en/docs/tutorial/where.md similarity index 93% rename from docs/tutorial/where.md rename to docs/en/docs/tutorial/where.md index ca85a4dd00..60c0bb98f6 100644 --- a/docs/tutorial/where.md +++ b/docs/en/docs/tutorial/where.md @@ -35,7 +35,7 @@ And now we will update `select_heroes()` to filter the data. 👀 Full file preview ```Python hl_lines="36-41" -{!./docs_src/tutorial/select/tutorial001.py!} +{!../../docs_src/tutorial/select/tutorial001.py!} ``` @@ -190,7 +190,7 @@ We care specially about the **select** statement: ```Python hl_lines="5" # Code above omitted 👆 -{!./docs_src/tutorial/select/tutorial001.py[ln:36-41]!} +{!../../docs_src/tutorial/select/tutorial001.py[ln:36-41]!} # Code below omitted 👇 ``` @@ -199,7 +199,7 @@ We care specially about the **select** statement: 👀 Full file preview ```Python -{!./docs_src/tutorial/select/tutorial001.py!} +{!../../docs_src/tutorial/select/tutorial001.py!} ``` @@ -211,7 +211,7 @@ Now, the same way that we add `WHERE` to a SQL statement to filter rows, we can ```Python hl_lines="5" # Code above omitted 👆 -{!./docs_src/tutorial/where/tutorial001.py[ln:36-41]!} +{!../../docs_src/tutorial/where/tutorial001.py[ln:36-41]!} # Code below omitted 👇 ``` @@ -220,7 +220,7 @@ Now, the same way that we add `WHERE` to a SQL statement to filter rows, we can 👀 Full file preview ```Python -{!./docs_src/tutorial/where/tutorial001.py!} +{!../../docs_src/tutorial/where/tutorial001.py!} ``` @@ -463,7 +463,7 @@ It's actually the same as in previous chapters for selecting data: ```Python hl_lines="6-8" # Code above omitted 👆 -{!./docs_src/tutorial/where/tutorial001.py[ln:36-41]!} +{!../../docs_src/tutorial/where/tutorial001.py[ln:36-41]!} # Code below omitted 👇 ``` @@ -472,7 +472,7 @@ It's actually the same as in previous chapters for selecting data: 👀 Full file preview ```Python -{!./docs_src/tutorial/where/tutorial001.py!} +{!../../docs_src/tutorial/where/tutorial001.py!} ``` @@ -524,7 +524,7 @@ We could get the rows where a column is **not** equal to a value using `!=`: ```Python hl_lines="5" # Code above omitted 👆 -{!./docs_src/tutorial/where/tutorial002.py[ln:36-41]!} +{!../../docs_src/tutorial/where/tutorial002.py[ln:36-41]!} # Code below omitted 👇 ``` @@ -533,7 +533,7 @@ We could get the rows where a column is **not** equal to a value using `!=`: 👀 Full file preview ```Python -{!./docs_src/tutorial/where/tutorial002.py!} +{!../../docs_src/tutorial/where/tutorial002.py!} ``` @@ -552,7 +552,7 @@ Let's update the function `create_heroes()` and add some more rows to make the n ```Python hl_lines="4-10 13-19" # Code above omitted 👆 -{!./docs_src/tutorial/where/tutorial003.py[ln:23-41]!} +{!../../docs_src/tutorial/where/tutorial003.py[ln:23-41]!} # Code below omitted 👇 ``` @@ -561,7 +561,7 @@ Let's update the function `create_heroes()` and add some more rows to make the n 👀 Full file preview ```Python -{!./docs_src/tutorial/where/tutorial003.py!} +{!../../docs_src/tutorial/where/tutorial003.py!} ``` @@ -575,7 +575,7 @@ Now let's use `>` to get the rows where a column is **more than** a value: ```Python hl_lines="5" # Code above omitted 👆 -{!./docs_src/tutorial/where/tutorial003.py[ln:44-49]!} +{!../../docs_src/tutorial/where/tutorial003.py[ln:44-49]!} # Code below omitted 👇 ``` @@ -584,7 +584,7 @@ Now let's use `>` to get the rows where a column is **more than** a value: 👀 Full file preview ```Python -{!./docs_src/tutorial/where/tutorial003.py!} +{!../../docs_src/tutorial/where/tutorial003.py!} ``` @@ -607,7 +607,7 @@ Let's do that again, but with `>=` to get the rows where a column is **more than ```Python hl_lines="5" # Code above omitted 👆 -{!./docs_src/tutorial/where/tutorial004.py[ln:44-49]!} +{!../../docs_src/tutorial/where/tutorial004.py[ln:44-49]!} # Code below omitted 👇 ``` @@ -616,7 +616,7 @@ Let's do that again, but with `>=` to get the rows where a column is **more than 👀 Full file preview ```Python -{!./docs_src/tutorial/where/tutorial004.py!} +{!../../docs_src/tutorial/where/tutorial004.py!} ``` @@ -640,7 +640,7 @@ Similarly, we can use `<` to get the rows where a column is **less than** a valu ```Python hl_lines="5" # Code above omitted 👆 -{!./docs_src/tutorial/where/tutorial005.py[ln:44-49]!} +{!../../docs_src/tutorial/where/tutorial005.py[ln:44-49]!} # Code below omitted 👇 ``` @@ -649,7 +649,7 @@ Similarly, we can use `<` to get the rows where a column is **less than** a valu 👀 Full file preview ```Python -{!./docs_src/tutorial/where/tutorial005.py!} +{!../../docs_src/tutorial/where/tutorial005.py!} ``` @@ -670,7 +670,7 @@ Finally, we can use `<=` to get the rows where a column is **less than or equal* ```Python hl_lines="5" # Code above omitted 👆 -{!./docs_src/tutorial/where/tutorial006.py[ln:44-49]!} +{!../../docs_src/tutorial/where/tutorial006.py[ln:44-49]!} # Code below omitted 👇 ``` @@ -679,7 +679,7 @@ Finally, we can use `<=` to get the rows where a column is **less than or equal* 👀 Full file preview ```Python -{!./docs_src/tutorial/where/tutorial006.py!} +{!../../docs_src/tutorial/where/tutorial006.py!} ``` @@ -707,7 +707,7 @@ Because `.where()` returns the same special select object back, we can add more ```Python hl_lines="5" # Code above omitted 👆 -{!./docs_src/tutorial/where/tutorial007.py[ln:44-49]!} +{!../../docs_src/tutorial/where/tutorial007.py[ln:44-49]!} # Code below omitted 👇 ``` @@ -716,7 +716,7 @@ Because `.where()` returns the same special select object back, we can add more 👀 Full file preview ```Python -{!./docs_src/tutorial/where/tutorial007.py!} +{!../../docs_src/tutorial/where/tutorial007.py!} ``` @@ -763,7 +763,7 @@ As an alternative to using multiple `.where()` we can also pass several expressi ```Python hl_lines="5" # Code above omitted 👆 -{!./docs_src/tutorial/where/tutorial008.py[ln:44-49]!} +{!../../docs_src/tutorial/where/tutorial008.py[ln:44-49]!} # Code below omitted 👇 ``` @@ -772,7 +772,7 @@ As an alternative to using multiple `.where()` we can also pass several expressi 👀 Full file preview ```Python -{!./docs_src/tutorial/where/tutorial008.py!} +{!../../docs_src/tutorial/where/tutorial008.py!} ``` @@ -793,7 +793,7 @@ But we can also combine expressions using `OR`. Which means that **any** (but no To do it, you can import `or_`: ```Python hl_lines="3" -{!./docs_src/tutorial/where/tutorial009.py[ln:1-3]!} +{!../../docs_src/tutorial/where/tutorial009.py[ln:1-3]!} # Code below omitted 👇 ``` @@ -802,7 +802,7 @@ To do it, you can import `or_`: 👀 Full file preview ```Python -{!./docs_src/tutorial/where/tutorial009.py!} +{!../../docs_src/tutorial/where/tutorial009.py!} ``` @@ -814,7 +814,7 @@ For example, here we select the heroes that are the youngest OR the oldest: ```Python hl_lines="5" # Code above omitted 👆 -{!./docs_src/tutorial/where/tutorial009.py[ln:44-49]!} +{!../../docs_src/tutorial/where/tutorial009.py[ln:44-49]!} # Code below omitted 👇 ``` @@ -823,7 +823,7 @@ For example, here we select the heroes that are the youngest OR the oldest: 👀 Full file preview ```Python -{!./docs_src/tutorial/where/tutorial009.py!} +{!../../docs_src/tutorial/where/tutorial009.py!} ``` @@ -878,7 +878,7 @@ 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"): ```Python hl_lines="3" -{!./docs_src/tutorial/where/tutorial011.py[ln:1-3]!} +{!../../docs_src/tutorial/where/tutorial011.py[ln:1-3]!} # Code below omitted 👇 ``` @@ -887,7 +887,7 @@ To do that, we can import `col()` (as short for "column"): 👀 Full file preview ```Python -{!./docs_src/tutorial/where/tutorial011.py!} +{!../../docs_src/tutorial/where/tutorial011.py!} ``` @@ -897,7 +897,7 @@ And then put the **class attribute** inside `col()` when using it in a `.where() ```Python hl_lines="5" # Code above omitted 👆 -{!./docs_src/tutorial/where/tutorial011.py[ln:44-49]!} +{!../../docs_src/tutorial/where/tutorial011.py[ln:44-49]!} # Code below omitted 👇 ``` @@ -906,7 +906,7 @@ And then put the **class attribute** inside `col()` when using it in a `.where() 👀 Full file preview ```Python -{!./docs_src/tutorial/where/tutorial011.py!} +{!../../docs_src/tutorial/where/tutorial011.py!} ``` diff --git a/docs/en/mkdocs.yml b/docs/en/mkdocs.yml new file mode 100644 index 0000000000..4685945670 --- /dev/null +++ b/docs/en/mkdocs.yml @@ -0,0 +1,139 @@ +site_name: SQLModel +site_description: SQLModel, SQL databases in Python, designed for simplicity, compatibility, and robustness. +site_url: https://sqlmodel.tiangolo.com/ +theme: + name: material + custom_dir: overrides + palette: + - scheme: default + primary: deep purple + accent: amber + toggle: + icon: material/lightbulb + name: Switch to dark mode + - scheme: slate + primary: deep purple + accent: amber + toggle: + icon: material/lightbulb-outline + name: Switch to light mode + features: + - search.suggest + - search.highlight + - content.tabs.link + icon: + repo: fontawesome/brands/github-alt + logo: img/icon-white.svg + favicon: img/favicon.png + language: en +repo_name: tiangolo/sqlmodel +repo_url: https://github.com/tiangolo/sqlmodel +edit_uri: '' +nav: +- SQLModel: index.md +- Languages: + - en: / +- features.md +- databases.md +- db-to-code.md +- Tutorial - User Guide: + - tutorial/index.md + - tutorial/create-db-and-table-with-db-browser.md + - tutorial/create-db-and-table.md + - tutorial/insert.md + - tutorial/automatic-id-none-refresh.md + - tutorial/select.md + - tutorial/where.md + - tutorial/indexes.md + - tutorial/one.md + - tutorial/limit-and-offset.md + - tutorial/update.md + - tutorial/delete.md + - Connect Tables - JOIN: + - tutorial/connect/index.md + - tutorial/connect/create-connected-tables.md + - tutorial/connect/create-connected-rows.md + - tutorial/connect/read-connected-data.md + - tutorial/connect/update-data-connections.md + - tutorial/connect/remove-data-connections.md + - Relationship Attributes: + - tutorial/relationship-attributes/index.md + - tutorial/relationship-attributes/define-relationships-attributes.md + - tutorial/relationship-attributes/create-and-update-relationships.md + - tutorial/relationship-attributes/read-relationships.md + - tutorial/relationship-attributes/remove-relationships.md + - tutorial/relationship-attributes/back-populates.md + - tutorial/relationship-attributes/type-annotation-strings.md + - Many to Many: + - tutorial/many-to-many/index.md + - tutorial/many-to-many/create-models-with-link.md + - tutorial/many-to-many/create-data.md + - tutorial/many-to-many/update-remove-relationships.md + - tutorial/many-to-many/link-with-extra-fields.md + - tutorial/code-structure.md + - FastAPI and Pydantic: + - tutorial/fastapi/index.md + - tutorial/fastapi/simple-hero-api.md + - tutorial/fastapi/response-model.md + - tutorial/fastapi/multiple-models.md + - tutorial/fastapi/read-one.md + - tutorial/fastapi/limit-and-offset.md + - tutorial/fastapi/update.md + - tutorial/fastapi/delete.md + - tutorial/fastapi/session-with-dependency.md + - tutorial/fastapi/teams.md + - tutorial/fastapi/relationships.md + - tutorial/fastapi/tests.md +- Advanced User Guide: + - advanced/index.md + - advanced/decimal.md +- alternatives.md +- help.md +- contributing.md +- release-notes.md + +markdown_extensions: +- toc: + permalink: true +- markdown.extensions.codehilite: + guess_lang: false +- admonition +- codehilite +- extra +- pymdownx.superfences: + custom_fences: + - name: mermaid + class: mermaid + format: !!python/name:pymdownx.superfences.fence_code_format '' +- pymdownx.tabbed: + alternate_style: true +- mdx_include + +extra: + analytics: + provider: google + property: UA-205713594-2 + social: + - icon: fontawesome/brands/github-alt + link: https://github.com/tiangolo/sqlmodel + - icon: fontawesome/brands/twitter + link: https://twitter.com/tiangolo + - icon: fontawesome/brands/linkedin + link: https://www.linkedin.com/in/tiangolo + - icon: fontawesome/brands/dev + link: https://dev.to/tiangolo + - icon: fontawesome/brands/medium + link: https://medium.com/@tiangolo + - icon: fontawesome/solid/globe + link: https://tiangolo.com + alternate: + - link: / + name: en - English + +extra_css: + - css/termynal.css + - css/custom.css + +extra_javascript: + - js/termynal.js + - js/custom.js diff --git a/docs/overrides/main.html b/docs/en/overrides/main.html similarity index 100% rename from docs/overrides/main.html rename to docs/en/overrides/main.html diff --git a/docs/missing-translation.md b/docs/missing-translation.md new file mode 100644 index 0000000000..360762d15e --- /dev/null +++ b/docs/missing-translation.md @@ -0,0 +1,4 @@ +!!! warning + The current page still doesn't have a translation for this language. + + But you can help translating it: [Contributing](https://fastapi.tiangolo.com/contributing/){.internal-link target=_blank}. \ No newline at end of file diff --git a/mkdocs.yml b/mkdocs.yml deleted file mode 100644 index a27bbde8a1..0000000000 --- a/mkdocs.yml +++ /dev/null @@ -1,134 +0,0 @@ -site_name: SQLModel -site_description: SQLModel, SQL databases in Python, designed for simplicity, compatibility, and robustness. -site_url: https://sqlmodel.tiangolo.com/ -theme: - name: material - custom_dir: docs/overrides - palette: - - scheme: default - primary: deep purple - accent: amber - toggle: - icon: material/lightbulb - name: Switch to dark mode - - scheme: slate - primary: deep purple - accent: amber - toggle: - icon: material/lightbulb-outline - name: Switch to light mode - features: - - search.suggest - - search.highlight - - content.tabs.link - icon: - repo: fontawesome/brands/github-alt - logo: img/icon-white.svg - favicon: img/favicon.png - language: en -repo_name: tiangolo/sqlmodel -repo_url: https://github.com/tiangolo/sqlmodel -edit_uri: '' -nav: - - SQLModel: index.md - - features.md - - databases.md - - db-to-code.md - - Tutorial - User Guide: - - tutorial/index.md - - tutorial/create-db-and-table-with-db-browser.md - - tutorial/create-db-and-table.md - - tutorial/insert.md - - tutorial/automatic-id-none-refresh.md - - tutorial/select.md - - tutorial/where.md - - tutorial/indexes.md - - tutorial/one.md - - tutorial/limit-and-offset.md - - tutorial/update.md - - tutorial/delete.md - - Connect Tables - JOIN: - - tutorial/connect/index.md - - tutorial/connect/create-connected-tables.md - - tutorial/connect/create-connected-rows.md - - tutorial/connect/read-connected-data.md - - tutorial/connect/update-data-connections.md - - tutorial/connect/remove-data-connections.md - - Relationship Attributes: - - tutorial/relationship-attributes/index.md - - tutorial/relationship-attributes/define-relationships-attributes.md - - tutorial/relationship-attributes/create-and-update-relationships.md - - tutorial/relationship-attributes/read-relationships.md - - tutorial/relationship-attributes/remove-relationships.md - - tutorial/relationship-attributes/back-populates.md - - tutorial/relationship-attributes/type-annotation-strings.md - - Many to Many: - - tutorial/many-to-many/index.md - - tutorial/many-to-many/create-models-with-link.md - - tutorial/many-to-many/create-data.md - - tutorial/many-to-many/update-remove-relationships.md - - tutorial/many-to-many/link-with-extra-fields.md - - tutorial/code-structure.md - - FastAPI and Pydantic: - - tutorial/fastapi/index.md - - tutorial/fastapi/simple-hero-api.md - - tutorial/fastapi/response-model.md - - tutorial/fastapi/multiple-models.md - - tutorial/fastapi/read-one.md - - tutorial/fastapi/limit-and-offset.md - - tutorial/fastapi/update.md - - tutorial/fastapi/delete.md - - tutorial/fastapi/session-with-dependency.md - - tutorial/fastapi/teams.md - - tutorial/fastapi/relationships.md - - tutorial/fastapi/tests.md - - Advanced User Guide: - - advanced/index.md - - advanced/decimal.md - - alternatives.md - - help.md - - contributing.md - - release-notes.md - -markdown_extensions: -- toc: - permalink: true -- markdown.extensions.codehilite: - guess_lang: false -- admonition -- codehilite -- extra -- pymdownx.superfences: - custom_fences: - - name: mermaid - class: mermaid - format: !!python/name:pymdownx.superfences.fence_code_format '' -- pymdownx.tabbed: - alternate_style: true -- mdx_include - -extra: - analytics: - provider: google - property: UA-205713594-2 - social: - - icon: fontawesome/brands/github-alt - link: https://github.com/tiangolo/sqlmodel - - icon: fontawesome/brands/twitter - link: https://twitter.com/tiangolo - - icon: fontawesome/brands/linkedin - link: https://www.linkedin.com/in/tiangolo - - icon: fontawesome/brands/dev - link: https://dev.to/tiangolo - - icon: fontawesome/brands/medium - link: https://medium.com/@tiangolo - - icon: fontawesome/solid/globe - link: https://tiangolo.com - -extra_css: - - css/termynal.css - - css/custom.css - -extra_javascript: - - js/termynal.js - - js/custom.js diff --git a/pyproject.toml b/pyproject.toml index e3b1d3c279..2e0f1597e7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -34,6 +34,8 @@ python = "^3.6.1" SQLAlchemy = ">=1.4.17,<=1.4.41" pydantic = "^1.8.2" sqlalchemy2-stubs = {version = "*", allow-prereleases = true} +typer = "^0.7.0" +mkdocs-markdownextradata-plugin = "^0.2.5" [tool.poetry.dev-dependencies] pytest = "^7.0.1" diff --git a/scripts/docs.py b/scripts/docs.py new file mode 100644 index 0000000000..31f85dc124 --- /dev/null +++ b/scripts/docs.py @@ -0,0 +1,452 @@ +import os +import re +import shutil +import subprocess +from http.server import HTTPServer, SimpleHTTPRequestHandler +from multiprocessing import Pool +from pathlib import Path +from typing import Dict, List, Optional, Tuple + +import mkdocs.commands.build +import mkdocs.commands.serve +import mkdocs.config +import mkdocs.utils +import typer +import yaml +from jinja2 import Template + +app = typer.Typer() + +mkdocs_name = "mkdocs.yml" + +missing_translation_snippet = """ +{!../../docs/missing-translation.md!} +""" + +docs_path = Path("docs") +en_docs_path = Path("docs/en") +en_config_path: Path = en_docs_path / mkdocs_name + + +def get_en_config() -> dict: + return mkdocs.utils.yaml_load(en_config_path.read_text(encoding="utf-8")) + + +def get_lang_paths(): + return sorted(docs_path.iterdir()) + + +def lang_callback(lang: Optional[str]): + if lang is None: + return + if not lang.isalpha() or len(lang) != 2: + typer.echo("Use a 2 letter language code, like: es") + raise typer.Abort() + lang = lang.lower() + return lang + + +def complete_existing_lang(incomplete: str): + lang_path: Path + for lang_path in get_lang_paths(): + if lang_path.is_dir() and lang_path.name.startswith(incomplete): + yield lang_path.name + + +def get_base_lang_config(lang: str): + en_config = get_en_config() + sqlmodel_url_base = "https://sqlmodel.tiangolo.com/" + new_config = en_config.copy() + new_config["site_url"] = en_config["site_url"] + f"{lang}/" + new_config["theme"]["logo"] = sqlmodel_url_base + en_config["theme"]["logo"] + new_config["theme"]["favicon"] = sqlmodel_url_base + en_config["theme"]["favicon"] + new_config["theme"]["language"] = lang + new_config["nav"] = en_config["nav"][:2] + extra_css = [] + css: str + for css in en_config["extra_css"]: + if css.startswith("http"): + extra_css.append(css) + else: + extra_css.append(sqlmodel_url_base + css) + new_config["extra_css"] = extra_css + + extra_js = [] + js: str + for js in en_config["extra_javascript"]: + if js.startswith("http"): + extra_js.append(js) + else: + extra_js.append(sqlmodel_url_base + js) + new_config["extra_javascript"] = extra_js + return new_config + + +@app.command() +def new_lang(lang: str = typer.Argument(..., callback=lang_callback)): + """ + Generate a new docs translation directory for the language LANG. + + LANG should be a 2-letter language code, like: en, es, de, pt, etc. + """ + new_path: Path = Path("docs") / lang + if new_path.exists(): + typer.echo(f"The language was already created: {lang}") + raise typer.Abort() + new_path.mkdir() + new_config = get_base_lang_config(lang) + new_config_path: Path = Path(new_path) / mkdocs_name + new_config_path.write_text( + yaml.dump(new_config, sort_keys=False, width=200, allow_unicode=True), + encoding="utf-8", + ) + new_config_docs_path: Path = new_path / "docs" + new_config_docs_path.mkdir() + en_index_path: Path = en_docs_path / "docs" / "index.md" + new_index_path: Path = new_config_docs_path / "index.md" + en_index_content = en_index_path.read_text(encoding="utf-8") + new_index_content = f"{missing_translation_snippet}\n\n{en_index_content}" + new_index_path.write_text(new_index_content, encoding="utf-8") + new_overrides_gitignore_path = new_path / "overrides" / ".gitignore" + new_overrides_gitignore_path.parent.mkdir(parents=True, exist_ok=True) + new_overrides_gitignore_path.write_text("") + typer.secho(f"Successfully initialized: {new_path}", color=typer.colors.GREEN) + update_languages(lang=None) + + +@app.command() +def build_lang( + lang: str = typer.Argument( + ..., callback=lang_callback, autocompletion=complete_existing_lang + ) +): + """ + Build the docs for a language, filling missing pages with translation notifications. + """ + lang_path: Path = Path("docs") / lang + if not lang_path.is_dir(): + typer.echo(f"The language translation doesn't seem to exist yet: {lang}") + raise typer.Abort() + typer.echo(f"Building docs for: {lang}") + build_dir_path = Path("docs_build") + build_dir_path.mkdir(exist_ok=True) + build_lang_path = build_dir_path / lang + en_lang_path = Path("docs/en") + site_path = Path("site").absolute() + if lang == "en": + dist_path = site_path + else: + dist_path: Path = site_path / lang + shutil.rmtree(build_lang_path, ignore_errors=True) + shutil.copytree(lang_path, build_lang_path) + shutil.copytree(en_docs_path / "data", build_lang_path / "data") + overrides_src = en_docs_path / "overrides" + overrides_dest = build_lang_path / "overrides" + for path in overrides_src.iterdir(): + dest_path = overrides_dest / path.name + if not dest_path.exists(): + shutil.copy(path, dest_path) + en_config_path: Path = en_lang_path / mkdocs_name + en_config: dict = mkdocs.utils.yaml_load(en_config_path.read_text(encoding="utf-8")) + nav = en_config["nav"] + lang_config_path: Path = lang_path / mkdocs_name + lang_config: dict = mkdocs.utils.yaml_load( + lang_config_path.read_text(encoding="utf-8") + ) + lang_nav = lang_config["nav"] + # Exclude first 2 entries FastAPI and Languages, for custom handling + use_nav = nav[2:] + lang_use_nav = lang_nav[2:] + file_to_nav = get_file_to_nav_map(use_nav) + sections = get_sections(use_nav) + lang_file_to_nav = get_file_to_nav_map(lang_use_nav) + use_lang_file_to_nav = get_file_to_nav_map(lang_use_nav) + for file in file_to_nav: + file_path = Path(file) + lang_file_path: Path = build_lang_path / "docs" / file_path + en_file_path: Path = en_lang_path / "docs" / file_path + lang_file_path.parent.mkdir(parents=True, exist_ok=True) + if not lang_file_path.is_file(): + en_text = en_file_path.read_text(encoding="utf-8") + lang_text = get_text_with_translate_missing(en_text) + lang_file_path.write_text(lang_text, encoding="utf-8") + file_key = file_to_nav[file] + use_lang_file_to_nav[file] = file_key + if file_key: + composite_key = () + new_key = () + for key_part in file_key: + composite_key += (key_part,) + key_first_file = sections[composite_key] + if key_first_file in lang_file_to_nav: + new_key = lang_file_to_nav[key_first_file] + else: + new_key += (key_part,) + use_lang_file_to_nav[file] = new_key + key_to_section = {(): []} + for file, orig_file_key in file_to_nav.items(): + if file in use_lang_file_to_nav: + file_key = use_lang_file_to_nav[file] + else: + file_key = orig_file_key + section = get_key_section(key_to_section=key_to_section, key=file_key) + section.append(file) + new_nav = key_to_section[()] + export_lang_nav = [lang_nav[0], nav[1]] + new_nav + lang_config["nav"] = export_lang_nav + build_lang_config_path: Path = build_lang_path / mkdocs_name + build_lang_config_path.write_text( + yaml.dump(lang_config, sort_keys=False, width=200, allow_unicode=True), + encoding="utf-8", + ) + current_dir = os.getcwd() + os.chdir(build_lang_path) + subprocess.run(["mkdocs", "build", "--site-dir", dist_path], check=True) + os.chdir(current_dir) + typer.secho(f"Successfully built docs for: {lang}", color=typer.colors.GREEN) + + +index_sponsors_template = """ +{% if sponsors %} +{% for sponsor in sponsors.gold -%} +
+{% endfor -%} +{%- for sponsor in sponsors.silver -%} + +{% endfor %} +{% endif %} +""" + + +def generate_readme_content(): + en_index = en_docs_path / "docs" / "index.md" + content = en_index.read_text("utf-8") + match_start = re.search(r"", content) + match_end = re.search(r"", content) + sponsors_data_path = en_docs_path / "data" / "sponsors.yml" + sponsors = mkdocs.utils.yaml_load(sponsors_data_path.read_text(encoding="utf-8")) + if not (match_start and match_end): + raise RuntimeError("Couldn't auto-generate sponsors section") + pre_end = match_start.end() + post_start = match_end.start() + template = Template(index_sponsors_template) + message = template.render(sponsors=sponsors) + pre_content = content[:pre_end] + post_content = content[post_start:] + new_content = pre_content + message + post_content + return new_content + + +@app.command() +def generate_readme(): + """ + Generate README.md content from main index.md + """ + typer.echo("Generating README") + readme_path = Path("README.md") + new_content = generate_readme_content() + readme_path.write_text(new_content, encoding="utf-8") + + +@app.command() +def verify_readme(): + """ + Verify README.md content from main index.md + """ + typer.echo("Verifying README") + readme_path = Path("README.md") + generated_content = generate_readme_content() + readme_content = readme_path.read_text("utf-8") + if generated_content != readme_content: + typer.secho( + "README.md outdated from the latest index.md", color=typer.colors.RED + ) + raise typer.Abort() + typer.echo("Valid README ✅") + + +@app.command() +def build_all(): + """ + Build mkdocs site for en, and then build each language inside, end result is located + at directory ./site/ with each language inside. + """ + site_path = Path("site").absolute() + update_languages(lang=None) + current_dir = os.getcwd() + os.chdir(en_docs_path) + typer.echo("Building docs for: en") + subprocess.run(["mkdocs", "build", "--site-dir", site_path], check=True) + os.chdir(current_dir) + langs = [] + for lang in get_lang_paths(): + if lang == en_docs_path or not lang.is_dir(): + continue + langs.append(lang.name) + cpu_count = os.cpu_count() or 1 + process_pool_size = cpu_count * 4 + typer.echo(f"Using process pool size: {process_pool_size}") + with Pool(process_pool_size) as p: + p.map(build_lang, langs) + + +def update_single_lang(lang: str): + lang_path = docs_path / lang + typer.echo(f"Updating {lang_path.name}") + update_config(lang_path.name) + + +@app.command() +def update_languages( + lang: str = typer.Argument( + None, callback=lang_callback, autocompletion=complete_existing_lang + ) +): + """ + Update the mkdocs.yml file Languages section including all the available languages. + + The LANG argument is a 2-letter language code. If it's not provided, update all the + mkdocs.yml files (for all the languages). + """ + if lang is None: + for lang_path in get_lang_paths(): + if lang_path.is_dir(): + update_single_lang(lang_path.name) + else: + update_single_lang(lang) + + +@app.command() +def serve(): + """ + A quick server to preview a built site with translations. + + For development, prefer the command live (or just mkdocs serve). + + This is here only to preview a site with translations already built. + + Make sure you run the build-all command first. + """ + typer.echo("Warning: this is a very simple server.") + typer.echo("For development, use the command live instead.") + typer.echo("This is here only to preview a site with translations already built.") + typer.echo("Make sure you run the build-all command first.") + os.chdir("site") + server_address = ("", 8008) + server = HTTPServer(server_address, SimpleHTTPRequestHandler) + typer.echo("Serving at: http://127.0.0.1:8008") + server.serve_forever() + + +@app.command() +def live( + lang: str = typer.Argument( + None, callback=lang_callback, autocompletion=complete_existing_lang + ) +): + """ + Serve with livereload a docs site for a specific language. + + This only shows the actual translated files, not the placeholders created with + build-all. + + Takes an optional LANG argument with the name of the language to serve, by default + en. + """ + if lang is None: + lang = "en" + lang_path: Path = docs_path / lang + os.chdir(lang_path) + mkdocs.commands.serve.serve(dev_addr="127.0.0.1:8008") + + +def update_config(lang: str): + lang_path: Path = docs_path / lang + config_path = lang_path / mkdocs_name + current_config: dict = mkdocs.utils.yaml_load( + config_path.read_text(encoding="utf-8") + ) + if lang == "en": + config = get_en_config() + else: + config = get_base_lang_config(lang) + config["nav"] = current_config["nav"] + config["theme"]["language"] = current_config["theme"]["language"] + languages = [{"en": "/"}] + alternate: List[Dict[str, str]] = config["extra"].get("alternate", []) + alternate_dict = {alt["link"]: alt["name"] for alt in alternate} + new_alternate: List[Dict[str, str]] = [] + for lang_path in get_lang_paths(): + if lang_path.name == "en" or not lang_path.is_dir(): + continue + name = lang_path.name + languages.append({name: f"/{name}/"}) + for lang_dict in languages: + name = list(lang_dict.keys())[0] + url = lang_dict[name] + if url not in alternate_dict: + new_alternate.append({"link": url, "name": name}) + else: + use_name = alternate_dict[url] + new_alternate.append({"link": url, "name": use_name}) + config["nav"][1] = {"Languages": languages} + config["extra"]["alternate"] = new_alternate + config_path.write_text( + yaml.dump(config, sort_keys=False, width=200, allow_unicode=True), + encoding="utf-8", + ) + + +def get_key_section( + *, key_to_section: Dict[Tuple[str, ...], list], key: Tuple[str, ...] +) -> list: + if key in key_to_section: + return key_to_section[key] + super_key = key[:-1] + title = key[-1] + super_section = get_key_section(key_to_section=key_to_section, key=super_key) + new_section = [] + super_section.append({title: new_section}) + key_to_section[key] = new_section + return new_section + + +def get_text_with_translate_missing(text: str) -> str: + lines = text.splitlines() + lines.insert(1, missing_translation_snippet) + new_text = "\n".join(lines) + return new_text + + +def get_file_to_nav_map(nav: list) -> Dict[str, Tuple[str, ...]]: + file_to_nav = {} + for item in nav: + if type(item) is str: + file_to_nav[item] = () + elif type(item) is dict: + item_key = list(item.keys())[0] + sub_nav = item[item_key] + sub_file_to_nav = get_file_to_nav_map(sub_nav) + for k, v in sub_file_to_nav.items(): + file_to_nav[k] = (item_key,) + v + return file_to_nav + + +def get_sections(nav: list) -> Dict[Tuple[str, ...], str]: + sections = {} + for item in nav: + if type(item) is str: + continue + elif type(item) is dict: + item_key = list(itemkdocs-markdownextradata-pluginm.keys())[0] + sub_nav = item[item_key] + sections[(item_key,)] = sub_nav[0] + sub_sections = get_sections(sub_nav) + for k, v in sub_sections.items(): + new_key = (item_key,) + k + sections[new_key] = v + return sections + + +if __name__ == "__main__": + app()