How to convert prisma $queryRaw to drizzle
I have a query like this. I want to just drop in the SQL the same way but can't seem to get it to work with
TypeError: query.getSQL is not a functionhow am i supposed to do this?
12 Replies
i tried converting this to more drizzle-esque code:
RangeError: Maximum call stack size exceeded
This seems good to me. Was this maybe related with the issue with the sql from the other post?
@Angelelz any idea why this might not be auto importing properly? when i was exporting * it would import correctly. do i need to install some separate types package? seems wrong
works fine for all other imports other than drizzle-orm
will check shortly
Autoimports depend too much on the environment you're on. Is drizzle-orm a dependecy in your closest package.json?
do you also need drizzle-kit maybe?
doubt it
Definitely not
getting really strange behavior with this. reprod on other dev's computer. must be a tsconfig thing or something, but ive never seen such an issue. maybe some sort of bug in drizzle-orm? will put together a minimal repro and report back
this is now resolved, but for some reason it says
PostgresError: aggregate functions are not allowed in GROUP BY
if i just do the entire query without drizzle, it works fineThis is a postgres error, if you're aggregating results you'll need to group them somehow
In your original one, it seems like you're grouping by columns 1, 2 and 3, but I see that the order is different in the new one
bingo
thanks
This is the type of query where drizzle shines. You can see how you have so much flexibility in creating your queries, without loosing types
yeah this is awesome
its amazing