Replies: 12 comments 35 replies
-
Any reason you've opened this as a discussion instead of issue? |
Beta Was this translation helpful? Give feedback.
-
This should go into the docs, I'm hitting this problem myself just now, and I assumed it's me getting the syntax not right, because--and this is good--TS complains about nested And this is kind of a dealbreaker because this things reads and sends the entire db for even most simple use cases/queries. Hope, I got something wrong. Edit: But the docs state examples with nexted |
Beta Was this translation helpful? Give feedback.
-
I'm running into the same issue. It's not possible to specify |
Beta Was this translation helpful? Give feedback.
-
same issue, pretty upset because i caught it by accident:
gives me results like:
going to drop the relational queries and use normal sql i guess? |
Beta Was this translation helpful? Give feedback.
-
is this getting worked at? |
Beta Was this translation helpful? Give feedback.
-
The |
Beta Was this translation helpful? Give feedback.
-
I believe that is how any ORM will implement internally anyway. This is an inherent limitation of SQL. A.k.a. If you remove drizzle you have to do something similar anyway. At least you are forced to learn how SQL actually works if you don't want to create indexing and intermediate tables (or materialized views or views) to speed things up. If drizzle can add some QoL to make things optimized by default that would be awesome. E.g. it automatically create a materialized view for the sub query, or add indexing for the table used in the subquery |
Beta Was this translation helpful? Give feedback.
-
I'd really appreciate this feature too. If I fall back to using the full |
Beta Was this translation helpful? Give feedback.
-
that's now in progress |
Beta Was this translation helpful? Give feedback.
-
![]() I think this is related - I can't use offset pagination with this because it returns a user per each role it finds so it returns duplicate users Am I writing this query wrong? |
Beta Was this translation helpful? Give feedback.
-
Can we also consider cross filtering and independent filters for V2? Not just for one-to-one but many-to-many relations. Provided that the filter ids and target is known, what will the structure look like if it is solved with inline conditionals, without going excessive or repeating queries |
Beta Was this translation helpful? Give feedback.
-
I wonder if we can get a preview release for this? |
Beta Was this translation helpful? Give feedback.
-
I would like to create queries that filter by single values from a nested partial fields select.
Imagine we have a
users
table with a one-to-one relation to a profile. Theprofiles
table has alikes
and acreatedAt
columns that store the amount of likes and the date the profile was created, respectively.In this example I want to get all the users named "john" whose profile has more than 5 likes and was created within the last 30 days.
This is currently not possible with Drizzle. The workaround I found is filtering after getting the result from the database.
This is not ideal because I have to read more rows than I need to. Is there a good reason to do things this way? Is it more performant?
UPDATE: Omar McAdam, provided a solution/workaround. This is how you could use it to filter in this example:
Beta Was this translation helpful? Give feedback.
All reactions