You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, the only way to access a partial type to make queries and get it as a return type is to import it from partials directly.
fromprisma.partialsimportPartialUserres=PartialUser.prisma().find_unique(...)
# res is PartialUser, as we want
however,
fromprismaimportPrismaclient=Prisma()
awaitclient.connect()
res=client.user.find_unique(...)
# res is User, and there is currently no way to get a PartialUser back
Suggested solution
Allow partials to be accessed through client:
fromprismaimportPrismaclient=Prisma()
awaitclient.connect()
res=client.partialuser.find_unique(...)
# res is PartialUser
Additional context
This is particularly useful when the prisma client is injected into a function or class for easy testing. It also facilitates the use of the context manager for increased security from errors.
The text was updated successfully, but these errors were encountered:
Problem
Currently, the only way to access a partial type to make queries and get it as a return type is to import it from partials directly.
however,
Suggested solution
Allow partials to be accessed through client:
Additional context
This is particularly useful when the prisma client is injected into a function or class for easy testing. It also facilitates the use of the context manager for increased security from errors.
The text was updated successfully, but these errors were encountered: