Skip to content
This repository was archived by the owner on Apr 15, 2025. It is now read-only.
This repository was archived by the owner on Apr 15, 2025. It is now read-only.

Improve error message when running prisma with an outdated client #1008

@AdeelK93

Description

@AdeelK93

Problem

When upgrading to a newer version of prisma python client - let's say, 0.13.1 to 0.14.0, if you forget to run prisma generate again, you'll get an error message like this

File "/Users/adeel/Documents/GitHub/my-project/backend/utils/db.py", line 36, in get_db
_db = Prisma(auto_register=True, datasource={"url": get_db_uri(application_name)})
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/adeel/Library/Caches/pypoetry/virtualenvs/my-project-cJkWU15t-py3.12/lib/python3.12/site-packages/prisma/client.py", line 156, in init
self._set_generated_properties(
TypeError: BasePrisma._set_generated_properties() missing 1 required keyword-only argument: 'preview_features'

It's not very obvious based on this preview_features message that this error actually stems from an outdated client.

Suggested solution

The prisma library already knows prisma.__version__. We should also track the version used for generating the client - and if it's missing or mismatched, raise an error.

Alternatives

Additional context

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions