Reverse relation support with foreign keys #581
sumitsharansatsangi
started this conversation in
Ideas
Replies: 2 comments 3 replies
-
@sumitsharansatsangi Reverse FK lookups is currently not supported. There is discussion about what the reverse lookup API should look like, but that's about it. There is no implementation for it yet. Here is workaround if you need a list of bands related to one manager. |
Beta Was this translation helpful? Give feedback.
0 replies
-
Tried the following, received an error.
Have I done anything wrong?? |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I didn't find any support for reverse relation support for related Table in the documentation.
Let's we have two table.
Now, While fetching Manager records, how can I fetch bands related to it too.
Currently, What I found as a solution is the following
bands = await Band.select(Band.name, Band.manager.all_columns())
It is using Band , not Manager , so the representation of the result changes.
Django-orm and SqlAlchemy supports this using related_name and back_ref respectively.
Beta Was this translation helpful? Give feedback.
All reactions