New features
Support for case insensitive string filtering
This feature is only supported when using PostgreSQL and MongoDB.
py
user = await client.user.find_first(
where={
'name': {
'contains': 'robert',
'mode': 'insensitive',
},
},
)
Prisma Update
The internal Prisma binaries that Prisma Client Python uses have been upgraded from `2.30.0` to `3.1.1`.
This brings with it a lot of new features and improvements:
- Referential Actions
- Named Constraints
- Microsoft SQL Server and Azure SQL Connector
For a full list of changes see https://github.com/prisma/prisma/releases/tag/3.1.1 and https://github.com/prisma/prisma/releases/tag/3.0.1
Type Validator
Prisma Client Python now comes bundled with a type validator, this makes it much easier to pass untrusted / untyped arguments to queries in a robust and type safe manner:
py
import prisma
from prisma.types import UserCreateInput
def get_untrusted_input():
return {'points': input('Enter how many points you have: ')}
data = prisma.validate(UserCreateInput, get_untrusted_input())
await client.user.create(data=data)
Any invalid input would then raise an easy to understand error (note: edited for brevity):
Enter how many points you have: a lot
Traceback:
pydantic.error_wrappers.ValidationError: 1 validation error for UserCreateInput
points
value is not a valid integer (type=type_error.integer)
Minor Changes
- Improved supported for the windows platform (not officially supported yet)