✏️ Fix grammar and typos in docs - #2058
Conversation
42e88d8 to
c9834e0
Compare
YuriiMotov
left a comment
There was a problem hiding this comment.
Added some clarifications
| * `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: |
There was a problem hiding this comment.
Responses are being read by clients, not from clients
| ## 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. |
There was a problem hiding this comment.
There is no such syntax in SQLModel. In code example it's hero = session.get(Hero, hero_id)
| 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: |
There was a problem hiding this comment.
There was a wrong word order in initial sentence:
we already declared what is the
foreign_key
should be
we already declared what the
foreign_keyis
(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
| ## One Session per Request | ||
|
|
||
| Remember that we should use a SQLModel **session** per each group of operations and if we need other unrelated operations we should use a different session? | ||
| Remember that we should use a SQLModel **session** per group of operations and if we need other unrelated operations we should use a different session? |
There was a problem hiding this comment.
per is not used with each. It already means for each
| ## Run the **FastAPI** Server in Production Mode | ||
|
|
||
| The development mode should not be used in production, as it includes automatic reload by default it consumes much more resources than necessary, and it would be more error prone, etc. | ||
| The development mode should not be used in production: it includes automatic reload by default, which consumes far more resources than necessary and is more error-prone. |
There was a problem hiding this comment.
LLM failed to understand this sentence and suggested silly edits. After several iterations we came to this rephrasing.
| > * `"Dive Wilson"` | ||
|
|
||
| ### Try it in DB Explorer for SQLite | ||
| ### Try it in DB Browser for SQLite |
There was a problem hiding this comment.
| </tr> | ||
| <tr> | ||
| <td>1</td><td>Deadpond</td><td>Dive Wilson</td><td>null</td><td>Z-Factor</td><td>Sister Margaret's Bar</td> | ||
| <td>1</td><td>Deadpond</td><td>Dive Wilson</td><td>null</td><td>Z-Force</td><td>Sister Margaret's Bar</td> |
There was a problem hiding this comment.
It's Z-Force everywhere else, and I checked it's not intentional
|
|
||
| Takes an optional LANG argument with the name of the language to serve, by default | ||
| en. | ||
| Serve the docs site with livereload, at http://127.0.0.1:8008. |
There was a problem hiding this comment.
Leftover from FastAPI's version
|
|
||
| This is the original SQLAlchemy `session.execute()` method that returns objects | ||
| of type `Row`, and that you have to call `scalars()` to get the model objects. | ||
| of type `Row`, on which you have to call `scalars()` to get the model objects. |
There was a problem hiding this comment.
This can break the warning filters in tests for people who are using this method. But it's easily fixable
| raise ValueError( | ||
| "Can't use sqlmodel_update() with something that " | ||
| f"is not a dict or SQLModel or Pydantic model: {obj}" | ||
| f"is not a dict, SQLModel, or Pydantic model: {obj}" |
There was a problem hiding this comment.
This updates the error message - hope it will not break someone's code :)
Description
Fixed typos and grammar mistakes in docs.
AI Disclaimer
I used Claude Code to find and fix mistakes, but carefully reviewed all corrections and asked to rephrase a couple of sentences to make them easier to read.
Checklist