Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 883
✏️ Fix grammar and typos in docs#2058
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Uh oh!
There was an error while loading. Please reload this page.
Changes from all commits
059eb6ee8da204561bf0aed6d0d8872e74c94686aa5e42c98879820c3f9d03dac02cfdc9834e0f8468ce2555726File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -20,7 +20,7 @@ When we create a new `Hero` instance, we don't set the `id`: | ||
| ### How `int | None` Helps | ||
| Because we don't set the `id`, it takes the Python's default value of `None` that we set in `Field(default=None)`. | ||
| Because we don't set the `id`, it takes Python's default value of `None` that we set in `Field(default=None)`. | ||
| This is the only reason why we define it with `int | None` and with a default value of `None`. | ||
| @@ -249,7 +249,7 @@ session.refresh(hero_1) | ||
| ...the **session** goes and makes the **engine** communicate with the database to get the recent data for this object `hero_1`, and then the **session** puts the data in the `hero_1` object and marks it as "fresh" or "not expired". | ||
| Here's how the output would look like: | ||
| Here's what the output would look like: | ||
| <div class="termy"> | ||
| @@ -442,4 +442,4 @@ If you understood all that, now you know a lot about **SQLModel**, SQLAlchemy, a | ||
| If you didn't get all that, it's fine, you can always come back later to <abbr title="See what I did there? 😜">`refresh`</abbr> the concepts. | ||
| I think this might be one of the main types of bugs that cause problems and makes you scratch your head. So, good job studying it! 💪 | ||
| I think this might be one of the main types of bugs that cause problems and make you scratch your head. So, good job studying it! 💪 | ||
tiangolo marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -249,7 +249,7 @@ This `JOIN` will be useful in a bit to be able to also get Spider-Boy, even if h | ||
| The same way there's a `.where()` available when using `select()`, there's also a `.join()`. | ||
| And in SQLModel (actually SQLAlchemy), when using the `.join()`, because we already declared what is the `foreign_key` when creating the models, we don't have to pass an `ON` part, it is inferred automatically: | ||
| And in SQLModel (actually SQLAlchemy), we don't have to pass an `ON` part when using `.join()`. It is inferred automatically because we already declared the `foreign_key` in the model definition: | ||
tiangolo marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| {* ./docs_src/tutorial/connect/select/tutorial002_py310.py ln[61:66] hl[63] *} | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -98,7 +98,7 @@ But we also want to have a `HeroCreate` for the data we want to receive when **c | ||
| * `secret_name`, required | ||
| * `age`, optional | ||
| And we want to have a `HeroPublic` with the `id` field, but this time with a type of `id: int`, instead of `id: int | None`, to make it clear that it will always have an `int` in responses **read** from the clients: | ||
| And we want to have a `HeroPublic` with the `id` field, but this time with a type of `id: int`, instead of `id: int | None`, to make it clear that it will always have an `int` in responses **read** by the clients: | ||
tiangolo marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| * `id`, required | ||
| * `name`, required | ||
| @@ -129,7 +129,7 @@ We will improve this code to avoid duplicating the fields, but for now we can co | ||
| Let's now see how to use these new models in the FastAPI application. | ||
| Let's first check how is the process to create a hero now: | ||
| Let's first check how we create a hero now: | ||
| {* ./docs_src/tutorial/fastapi/multiple_models/tutorial001_py310.py ln[44:51] hl[44:45,47] *} | ||
| @@ -235,7 +235,7 @@ And those inherited fields will also be in the **autocompletion** and **inline e | ||
| ### Columns and Inheritance with Multiple Models | ||
| Notice that the parent model `HeroBase` is not a **table model**, but still, we can declare `name` and `age` using `Field(index=True)`. | ||
| Notice that the parent model `HeroBase` is not a **table model**, but still, we can declare `name` and `age` using `Field(index=True)`. | ||
| {* ./docs_src/tutorial/fastapi/multiple_models/tutorial002_py310.py ln[5:12] hl[6,8,11] *} | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -24,7 +24,7 @@ For example, to get the hero with ID `2` we would send a `GET` request to: | ||
| ## Handling Errors | ||
| Then, because FastAPI already takes care of making sure that the `hero_id` is an actual integer, we can use it directly with `Hero.get()` to try and get one hero by that ID. | ||
| Then, because FastAPI already takes care of making sure that the `hero_id` is an actual integer, we can use it directly with `session.get()` to try and get one hero by that ID. | ||
tiangolo marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| But if the integer is not the ID of any hero in the database, it will not find anything, and the variable `hero` will be `None`. | ||
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.