It looks like the same kind of issue described her...
# prisma-client
c
It looks like the same kind of issue described here https://githubmemory.com/repo/prisma/prisma/issues/7395
r
@Chris 👋 Thanks for reporting. This is a known issue regarding both the Decimal and BigInt types and we will look into this 🙂
c
Hi Ryan, thanks for getting back to me. I'm very new to Prisma so was initially thinking I was doing something wrong. After seeing that other issue it became clear to me it was actually a bug - so I opened an issue specific to Decimal here https://github.com/prisma/prisma/issues/9163
@Ryan I see the BigInt issue has been open for 3 months. As I say I'm very new to Prisma, so don't know how quickly one can expect fixes to issues. I'm very concerned about this issue - I'd say half of our queries will be executed via queryRaw - and already see this as a potential show stopper. Do you have a) a gut guess on how long it may take for a fix to appear, and b) any suggestions for a workaround in the meantime?
r
Unfortunately we don’t have an ETA on this as we have other requests/bugs lined up. As for the implementation, this requires fixes in both the Engine and the TypeScri[t side - so it would take some time 🙂
c
@Ryan thanks for your response. We are developing a data reporting application, with TypeScript, with ~1/2 of the queries we need being hand written to perform calculations on Decimals. What library would you most recommend for such a use case? Do you think Prisma is still a good option?
As a possible work around - do you think casting Decimals to Strings in our raw queries, and then parsing to Decimal.js objects code-side, would be a good option?
r
Yes I think that would be the only way as of now.
c
@Ryan do you think Prisma is appropriate for a use case like ours, where we have a lot of custom queries performing calculations?
r
Imo if you have a lot of custom/raw queries, then you would need to use Prisma’s raw query mechanism and pass the types for the data manually, so you won’t be getting the benefits of using Prisma in that case.
c
I like what Prisma offers in terms of: • constructing the schema in code • migrations • convenient, typed results for 1/2 our queries
To not have the benefits of typed queries on half our queries seems like it would be an acceptable trade-off, unless it presented significant obstacles for executing those queries.
r
I don’t think it will be an obstacle as the raw query would just be untyped, there’s no other drawback.
c
If the only obstacle is needing to cast to string in our query, and then create a decimal.js object with the result that comes back - and this is something that will eventually be fixed in Prisma - then I feel like it falls on the side of being acceptable
💯 1
I'm still new to Prisma though
r
I’m still new to Prisma though
That wouldn’t be a problem, Prisma’s API is self explanatory if you’re running queries directly through Prisma and raw queries would be as is, so you should be fine 🙂
c
I wonder if middelware could be used to take care of this in the meantime ...
r
It should be, but you would need to recursively find all the fields in the response and convert them, so basically write the helpers yourself.