Releases: RobertCraigie/prisma-client-py
v0.2.1
New features
Support for case insensitive string filtering
This feature is only supported when using PostgreSQL and MongoDB.
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:
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)
v0.2.0
🚨 This release contains breaking changes 🚨
Filtering field types by NOT
and IN
has been renamed to not
and in
.
For example:
post = await client.post.find_first(
where={
'title': {
'NOT': 'Exclude title',
},
},
)
Must now be written as:
post = await client.post.find_first(
where={
'title': {
'not': 'Exclude title',
},
},
)
Bug fixes
- Fixes filtering records by
NOT
(#70)
v0.1.0
This release does not contain any new features and is simply to mark the start of new version guarantees.
Breaking changes will now be released under a new MINOR version instead of the previous PATCH.
MAJOR
.MINOR
.PATCH
v0.0.4
🚨 This release contains breaking changes 🚨
Removal of aiohttp and requests
Support for aiohttp
and requests
has been removed in favour of httpx, as httpx supports both asynchronous
and synchronous
clients within the same library there is no reason to use aiohttp
or requests
anymore.
This means that the way you install Prisma Client Python will change. You now no longer need to specify an extra, for example
pip install prisma-client[aiohttp]
turns into
pip install prisma-client
Config changes
The http
option has been replaced with the interface
option. The new interface
option is used to control whether or not the generated client is asynchronous.
Migrating
If you used aiohttp
before you should use the following:
generator client {
provider = "prisma-client-py"
interface = "asyncio"
}
If you used requests
before you should use the following:
generator client {
provider = "prisma-client-py"
interface = "sync"
}
Changes
Support for Json types
You can now make use of Prisma's Json
type.
model User {
id Int @default(autoincrement())
meta Json
}
You can create and search for Json
values like so:
from prisma import Json
user = await client.user.create(
data={
'meta': Json.keys(country='Scotland'),
}
)
from prisma import Json
user = await client.user.find_first(
where={
'meta': Json({'country': 'Scotland'})
# or
'meta': {
'equals': Json.keys(country='Scotland'),
'NOT': Json(['foo']),
}
}
)
Other changes
- Adds support for
BigInt
types. - Improves error message for unsupported types.
- Improves type safety for atomic updates.
v0.0.3
This release fixes broken links in the README
v0.0.2
This release fixes an issue with unresolvable dev dependencies.
I added twine
as a dev dependency to publish prisma-client-py to PyPi which ended up causing version conflicts. Twine has been removed as a dependency.
Initial Public Release
This release is the first public release.
Features can be found in the documentation: https://prisma-client-py.readthedocs.io/