Skip to content

v0.4.3

Compare
Choose a tag to compare
@RobertCraigie RobertCraigie released this 05 Jan 21:11
· 491 commits to main since this release
43bdcc5

Bug fixes

  • Correctly render Enum fields within compound keys (#190)

What's Changed

Subclassing pseudo-recursive models

Subclassing pseudo-recursive models will now raise a warning instead of crashing, static types will still not respect the subclass, for example:

from prisma.models import User

class MyUser(User):
    @property
    def fullname(self) -> str:
        return f'{self.name} {self.surname}'

# static type checkers will think that `user` is an instance of `User` when it is actually `MyUser` at runtime
# you can fix this by following the steps here:
# https://prisma-client-py.readthedocs.io/en/stable/reference/limitations/#removing-limitations
user = MyUser.prisma().create(
    data={
        'name': 'Robert',
        'surname': 'Craigie',
    },
)

For more details, see the documentation

Default HTTP timeout increased

The default HTTP timeout used to communicate with the internal Query Engine has been increased from 5 seconds to 30 seconds, this means you should no longer encounter timeout errors when executing very large queries.

Customise the internal HTTPX Client

You can now customise the HTTPX Client used to communicate with the internal query engine, this could be useful if you need to increase the http timeout, for full reference see the documentation.

client = Client(
    http={
        'timeout': 100,
    },
)

Prisma Upgrade

The internal Prisma binaries that Prisma Client Python makes use of have been upgraded from v3.4.0 to v3.7.0 for a full changelog see:

Create partial models without any relational fields

Instead of having to manually update the list of excluded fields when creating partial models whenever a new relation is added you can now just use exclude_relational_fields=True!

from prisma.models import User
User.create_partial('UserWithoutRelations', exclude_relational_fields=True)
class UserWithoutRelations:
  id: str
  name: str
  email: Optional[str]