Replies: 2 comments 1 reply
-
Yeah, it's tricky because
If it's a UUID then Maybe a solution is to have a method like: class Band(Table):
def get_foreign_key_value(self, foreign_key: ForeignKey) -> uuid.UUID:
... And then: >>> band.get_foreign_key_value(Band.genre)
UUID('abcd-1234-....-....') |
Beta Was this translation helpful? Give feedback.
-
To access genre.uuid without triggering an unnecessary join, store only the foreign key UUID in band.genre, not the entire Genre object. This avoids implicit joins and simplifies type annotations, keeping band.genre: UUID. Use an explicit join only when the full Genre data is needed. For example: |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Assume you have a table such as:
When I gather data from
Band
I would like to accessGenre
's uuid like:There's afew reasons why:
Band.objects(Band.genre)
band.genre
could beGenre | UUID
Beta Was this translation helpful? Give feedback.
All reactions