Two-to-many relationship #1390
madduck
started this conversation in
Show and tell
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I spent a bit more time than I wanted on getting a two-to-many relationship working, and so I thought I'd better document it here for others to benefit:
Thanks to @dlax and also and CaselIT (Federico Caselli) for their help!
The only issue with this code right now is that
pyright
reports an error on the two join lines:I replicated the exact same code using pure SQLAlchemy, and I don't see the error there. I suspect it's due to (having to) use
sqlalchemy.orm.aliased
sincesqlmodel
seems not to provide such a wrapper. For now, it's#type:ignore
for me, but maybe someone has a solution…?Bug report is here: #1391
PS: always interested in comments and suggestions to improve.
Beta Was this translation helpful? Give feedback.
All reactions