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
This would allow users to retrieve only the specified fields from the database query result, providing more flexibility and efficiency in data retrieval.
Alternatives
Without support for the select feature, users are forced to retrieve the entire record from the database and manually extract the required fields, which can be cumbersome and inefficient, especially for large datasets.
Adding support for the select feature in Prisma Python would align the functionality of the Python client with other Prisma client libraries, providing a consistent experience across different programming languages. This feature would greatly enhance the usability and versatility of Prisma Python for data retrieval tasks.
The text was updated successfully, but these errors were encountered:
generator client {
provider = "prisma-client-py"
interface = "asyncio"
recursive_type_depth = "5"
partial_type_generator = "prisma/partial_types.py"
}
model User {
id Int @id @default(autoincrement())
name String @db.VarChar(30)
age Float
password String
country String
}
Run prisma generate
prisma/partial_types.py
from prisma.models import User
User.create_partial('UserWithName', include={'name'})
# Use of Partial Type
from prisma.partials import UserWithName
user = await UserWithName.prisma().find_first(
where={
'country': 'Scotland',
},
)
print(user.name)
print(user.id) # error `id` does not exist on the `UserWithName` type
Problem
Currently, when using Prisma Python, there is no direct support for selecting specific fields from a database query result.
Suggested solution
See: Prisma Docs : Select fields
I suggest adding support for the select feature in Prisma Python, similar to the existing functionality in other Prisma client libraries.
For example:
This would allow users to retrieve only the specified fields from the database query result, providing more flexibility and efficiency in data retrieval.
Alternatives
Without support for the select feature, users are forced to retrieve the entire record from the database and manually extract the required fields, which can be cumbersome and inefficient, especially for large datasets.
Additional context
Adding support for the select feature in Prisma Python would align the functionality of the Python client with other Prisma client libraries, providing a consistent experience across different programming languages. This feature would greatly enhance the usability and versatility of Prisma Python for data retrieval tasks.
The text was updated successfully, but these errors were encountered: