-
-
Notifications
You must be signed in to change notification settings - Fork 8.5k
📝 Update Primary Key notes for the SQL databases tutorial to avoid confusion #14120
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
📝 Update Primary Key notes for the SQL databases tutorial to avoid confusion #14120
Conversation
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
|
Hi @FlaviusRaducu thank you for taking the time to submit the improvement. I think you're right in saying that section should be more explicit in why that type signature is required. I feel however you could reword the submission to make it read less "staccato" that is less of an edit and more like something that was always there. As an example, Copilot suggest re-wording the paragraph likes so: Declaring the type as int | None tells SQLModel that the column should be an INTEGER in the SQL database and that it can be NULL. However, in practice, the id column is always required and cannot be NULL—so why use int | None? The reason is that although the id is mandatory in the database, it's not provided by our code. Instead, it's automatically generated by the database itself. |
📝 Docs previewLast commit 237ce55 at: https://349bafed.fastapitiangolo.pages.dev Modified Pages |
YuriiMotov
left a comment
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.
LGTM!
tiangolo
left a comment
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.
Nice, thanks! 🚀
* Sync with #14217 * Sync with #14359 * Sync with #13786 * Sync with #14070 * Sync with #14120 * Sync with #14211 * Sync with #14405 * "to deploy" -> "deployen" The LLM used that translation a lot ithis convinced me that "deployen" it is the better word. "bereitstellen" (or "ausliefern") is still used for "to serve". --------- Co-authored-by: Motov Yurii <[email protected]> Co-authored-by: Yurii Motov <[email protected]>
For developers unfamiliar with
SQLModel( might be just me though :) ) creating a nullable primary key can be quite confusing when reading this tutorial section.I believe, adding a bit more information resolves that initial confusion.
The extra comments have been taken from the official SQLModel docs.