Skip to content

v0.4.0

Compare
Choose a tag to compare
@RobertCraigie RobertCraigie released this 27 Nov 18:21
· 534 commits to main since this release
c3587de

Breaking Changes

The following field names are now restricted and attempting to generate the client with any of them will now raise an error:

  • startswith
  • endswith
  • order_by
  • not_in
  • is_not

What's Changed

Support for the Bytes type

You can now create models that make use of binary data, this is stored in the underlying database as Base64 data, for example:

model User {
  id     Int @id @default(autoincrement())
  name   String
  binary Bytes
}
from prisma import Base64
from prisma.models import User

user = await User.prisma().create(
    data={
        'name': 'Robert',
        'binary': Base64.encode(b'my binary data'),
    },
)
print(f'binary data: {user.binary.decode()}')

Support for scalar list fields

You can now query for and update scalar list fields, for example:

model User {
  id     Int @id @default(autoincrement())
  emails String[]
}
user = await client.user.find_first(
    where={
        'emails': {
            'has': 'robert@craigie.dev',
        },
    },
)

For more details, visit the documentation: https://prisma-client-py.readthedocs.io/en/latest/reference/operations/#lists-fields

Argument deprecations

The order argument to the count() method has been deprecated, this will be removed in the next release.

Action Docstrings

All query action methods now have auto-generated docstrings specific for each model, this means that additional documentation will be shown when you hover over the method call in your IDE, for example:

Image showcasing docstring on hover

Other Changes

  • typing-extensions is now a required dependency