-
-
Notifications
You must be signed in to change notification settings - Fork 880
✏️ 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
base: main
Are you sure you want to change the base?
Changes from all commits
059eb6e
e8da204
561bf0a
ed6d0d8
872e74c
94686aa
5e42c98
879820c
3f9d03d
ac02cfd
c9834e0
f8468ce
File filter
Filter by extension
Conversations
Jump to
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! 💪 | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. make refers to bugs here |
||
| 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: | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a wrong word order in initial sentence:
should be
(is should go after the subject) But just moving "is" to correct place made the whole sentence even harder to read. I suggest rephrasing it this way |
||
|
|
||
| {* ./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: | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Responses are being read by clients, not from clients |
||
|
|
||
| * `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. | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There is no such syntax in SQLModel. In code example it's |
||
|
|
||
| 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`. | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's Z-Force everywhere else, and I checked it's not intentional