Registry / database / prisma

prisma

JSON →
library0.15.0pypypi✓ verified 24d ago

Prisma Client Python is an auto-generated and fully type-safe database client, offering a modern ORM experience built on top of the Rust-based Prisma Query Engine. It is known for strong type safety and excellent autocompletion features. The library is currently at version 0.15.0. **Important Note:** As of April 15, 2025, active development on Prisma Client Python has officially ceased due to the maintainer's lack of time and significant architectural changes in Prisma's core (rewriting from Rust to TypeScript). The repository was archived on April 15, 2025, and is now read-only, effectively abandoning the project.

pip install prisma
INSTALL
IMPORT
SIG · PRISMA
P
prisma
databasepythonv0.15.0
Install
4.4s avg
Import
Disk
35MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.15.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.000s · 35.9MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 4.4s · import 0.000s · 36MB
35MB installed
● package 35MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Prisma
from prisma import Prisma
from prisma import Prisma
PrismaMethod
from prisma import PrismaMethod
Metrics
from prisma import Metrics

To use Prisma Client Python, you must first define your database schema in a `schema.prisma` file and then run `prisma db push` (or `prisma generate`) from your terminal. This command generates the Python client code based on your schema. Afterwards, you can import and use the `Prisma` client to interact with your database. The example demonstrates an asynchronous client, connecting, creating a user, and finding a user.

import asyncio import os from prisma import Prisma # --- First, define your schema in a file named `schema.prisma` --- # datasource db { # provider = "sqlite" # url = "file:./dev.db" # } # # generator client { # provider = "prisma-client-py" # interface = "asyncio" # or "sync" # } # # model User { # id Int @id @default(autoincrement()) # email String @unique # name String? # } # ------------------------------------------------------------------ # --- Second, run `prisma db push` in your terminal to generate the client and apply schema --- # You might need to set DATABASE_URL environment variable if using a remote DB # os.environ['DATABASE_URL'] = os.environ.get('DATABASE_URL', 'sqlite:///dev.db') # Run: `prisma db push` # --- Third, use the generated client in your Python code --- async def main(): db = Prisma() await db.connect() # Create a user user = await db.user.create( data={ 'email': 'test@example.com', 'name': 'Test User' } ) print(f"Created user: {user.email}") # Find the user found_user = await db.user.find_unique( where={'email': 'test@example.com'} ) if found_user: print(f"Found user: {found_user.name}") else: print("User not found.") await db.disconnect() if __name__ == '__main__': # Example of setting DATABASE_URL if you're not using file:./dev.db in schema # os.environ['DATABASE_URL'] = os.environ.get('DATABASE_URL', 'sqlite:///dev.db') asyncio.run(main())
prisma --version
Debug
Known issues
breakingThe Prisma Client Python project has been officially abandoned by its maintainer as of April 15, 2025, and its GitHub repository is now read-only. No further development, bug fixes, or new features will be added. Users should consider alternative ORMs or be prepared to maintain a fork.
fix
Evaluate migration to a different ORM (e.g., SQLAlchemy, SQLModel) or be prepared to maintain a fork of this project.
affects: >=0.15.0
breakingSupport for Python 3.7 was dropped in version 0.14.0, as Python 3.7 reached its End-of-Life.
fix
Upgrade your Python environment to 3.8 or newer.
affects: >=0.14.0
gotchaThe Prisma Client Python is auto-generated based on your `schema.prisma` file. You must run `prisma generate` or `prisma db push` (which also generates the client) every time you modify your `schema.prisma` file for changes to be reflected in your Python code. Ensure your `generator client` block in `schema.prisma` specifies `provider = "prisma-client-py"`.
fix
Always execute `prisma db push` or `prisma generate` in your terminal after making changes to `schema.prisma`.
affects: all
gotchaWhen upgrading to Pydantic v2 (or using it alongside v1), there might be compatibility issues with `prisma.validate`. Specifically, errors raised by `prisma.validate` might need to be caught using `pydantic.v1.ValidationError` due to internal implementation details in v0.10.0.
fix
Import `ValidationError` from `pydantic.v1` for error handling related to `prisma.validate` if encountering issues with Pydantic v2.
affects: 0.10.0
gotchaPrisma Client Python's static type checking has limitations, especially when using `mypy`. It is highly recommended to use `pyright` as your type checker for Prisma Client Python applications to achieve the most accurate and comprehensive type safety.
fix
Configure your development environment to use `pyright` as the type checker.
affects: all
Upgrade
Version history
0.15.0latest on PyPI · released Aug 16, 2024
Audit
Dependencies
pydanticrequiredUsed for data models; compatibility considerations exist between Pydantic v1 and v2.
noderequiredThe underlying Prisma CLI, which Prisma Client Python wraps for schema migrations and client generation, requires Node.js to be installed on the system.
Agent activity
51 hits · last 30 days
node
46
Resources
prisma — pip install prisma · libregistry