-
-
Notifications
You must be signed in to change notification settings - Fork 783
📝 Add docs page for self-referential model #408
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?
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.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
|
@tiangolo, what's blocking this from being merged? |
|
This is some really helpful documentation. @svlandeg anything we can do to get this merged? |
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
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.
@daniil-berg, thanks for working on this!
Great job!
I suggested a few minor improvements. Could you please take a look?
Also, we should probably create a group in Advanced (e.g. "Advanced Relationships") for other relationships-related sections such as #815
This comment was marked as outdated.
This comment was marked as outdated.
Co-authored-by: Motov Yurii <[email protected]>
This comment was marked as outdated.
This comment was marked as outdated.
📝 Docs previewLast commit 2bc70be at: https://2d8bc465.sqlmodel.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!
svlandeg
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.
I didn't review in detail (as Yurii already did 🙌), but just a few small nitpicks 😇
Co-authored-by: Sofie Van Landeghem <[email protected]>
Purpose
Adds a new page explaining how to construct a self-referential/recursive relationship with SQLModel to the Advanced User Guide section of the documentation. This is arguably a fairly common use case that has been asked about and discussed in issue #127 already.
Code
The example code uses a
Villainclass/model for demonstration in an attempt at honoring theHerotheme of the documentation. A villain can have abossvillain and villainminions.Additional info
The new page also includes a brief explanation of the
sa_relationship_kwargsparameter of theRelationshipconstructor, since that is essential for defining the desired relationship. Depending on how @tiangolo wants to structure the rest of the advanced guide, this section may either need to be expanded or instead abbreviated to a short mention and link to a dedicated section forsa_-style parameters in SQLModel fields and relationships in the future.Update (2022-08-02)
Rebased onto most recent version of the
mainbranch (0.0.8 release, 75ce455).Then rebased again, after adding tests to cover the new documentation example code. Coverage of the added code should now be at 100% (see latest codecov checks).