Replies: 2 comments
-
The problem is likely in what follows after
|
Beta Was this translation helpful? Give feedback.
0 replies
-
@schaetz can you share your Table class Drift dealing with this ManyToOne relation please ? |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I have two SQL tables artists and tags with a 1:n relation, that means each artist can have a set of tags from 0 to infinite. I have a third table assigned_tags that models that relation, it just contains pairs of artist IDs and tag IDs.
Now I want to query all artists with their sets of tags in a single query. For that, I implemented a StreamTransformer that transforms a stream of artist/tag tuples to a stream of a list of artist data objects (without duplicate artists).
So in Drift, I need to join assigned_tags and tags so that the result contains tuples of artists and tags while making sure that artists without tags are still considered. I tried it like this:
However, with the innerJoin of tags I only get the artists that have at least one tag. So I tried two outer joins:
But that will cause the following exception:
I have neither found any documentation on readTableOrNull, nor do I see how I could use it here.
Is what I am trying to do even feasible with joins only, or will I have to make a nested query? Obviously, I care about performance, because this will be the main query for listing all artists.
Beta Was this translation helpful? Give feedback.
All reactions