Hi All, May be it looks like a stupid question , b...
# orm-help
n
Hi All, May be it looks like a stupid question , but I am currently understanding prisma to understand if we can use it in our application. Can anyone make me understand how Prisma is going to be useful for applications involving complex queries like the ones that were traditionally getting handled by joins and all.
a
Firstly, no question is stupid! Prisma gives you an abstraction over your database. It will enhance your developer experience (DX) as you do not have to write complex queries for your native db drivers. Querying using prisma is quite neat and easy to learn. It accepts graphql queries without any modifications and translates them into something your dbms would understand. You can have relation between data fields and use them to perform join like operations. I'm new to prisma too. Feel free to educate me if I mentioned something incorrect!
r
One fo the nice things about it is I can use the extremely intuitive standard "prisma methods" for querying CRUD and related kind of stuff. If I have a query that is too complex for the standard methods or not yet supported then I can drop back to their RAW methods (
queryRaw
and
executeRaw
.)
n
thanks ,yeah I got your point.. any idea on Is there some way by which we can still write manual queries if needed in worst cases like we used query builder ?
r
2 of the big things I find missing right now are
ordering by more than 1 item
and
case insensitivity
"query builder"? I know you can do raw sql..
n
ok
r
using queryRaw. If you need a stored procedure or something like that then use executeRaw (I think I got those right)
This is all
prisma2
that I'm talking about
n
so, in case we have a SP then we can call them using executeRaw thats what you are reffering ?
and by queryRaw we can simply write manual queries if needed
@Richard Ward for group by, were we able to handle those as well using prisma inbuilt functions somehow, or we need to use raw query methods for that?
r
Hey @Nishant Srivastava 👋 There is an open feature request for group by that you can follow here and so currently as a workaround, you would have to use
prisma.queryRaw
for that.
n
thanks a lot