{"id":5684,"library":"prisma","title":"Prisma Client Python","description":"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.","status":"abandoned","version":"0.15.0","language":"en","source_language":"en","source_url":"https://github.com/RobertCraigie/prisma-client-py","tags":["database","ORM","type-safe","abandoned"],"install":[{"cmd":"pip install prisma","lang":"bash","label":"Install latest version"}],"dependencies":[{"reason":"Used for data models; compatibility considerations exist between Pydantic v1 and v2.","package":"pydantic","optional":false},{"reason":"The underlying Prisma CLI, which Prisma Client Python wraps for schema migrations and client generation, requires Node.js to be installed on the system.","package":"node","optional":false}],"imports":[{"symbol":"Prisma","correct":"from prisma import Prisma"}],"quickstart":{"code":"import asyncio\nimport os\nfrom prisma import Prisma\n\n# --- First, define your schema in a file named `schema.prisma` ---\n# datasource db {\n#   provider = \"sqlite\"\n#   url      = \"file:./dev.db\"\n# }\n#\n# generator client {\n#   provider = \"prisma-client-py\"\n#   interface = \"asyncio\" # or \"sync\"\n# }\n#\n# model User {\n#   id    Int     @id @default(autoincrement())\n#   email String  @unique\n#   name  String?\n# }\n# ------------------------------------------------------------------\n\n# --- Second, run `prisma db push` in your terminal to generate the client and apply schema ---\n# You might need to set DATABASE_URL environment variable if using a remote DB\n# os.environ['DATABASE_URL'] = os.environ.get('DATABASE_URL', 'sqlite:///dev.db')\n# Run: `prisma db push`\n\n# --- Third, use the generated client in your Python code ---\nasync def main():\n    db = Prisma()\n    await db.connect()\n\n    # Create a user\n    user = await db.user.create(\n        data={\n            'email': 'test@example.com',\n            'name': 'Test User'\n        }\n    )\n    print(f\"Created user: {user.email}\")\n\n    # Find the user\n    found_user = await db.user.find_unique(\n        where={'email': 'test@example.com'}\n    )\n    if found_user:\n        print(f\"Found user: {found_user.name}\")\n    else:\n        print(\"User not found.\")\n\n    await db.disconnect()\n\nif __name__ == '__main__':\n    # Example of setting DATABASE_URL if you're not using file:./dev.db in schema\n    # os.environ['DATABASE_URL'] = os.environ.get('DATABASE_URL', 'sqlite:///dev.db')\n    asyncio.run(main())\n","lang":"python","description":"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."},"warnings":[{"fix":"Evaluate migration to a different ORM (e.g., SQLAlchemy, SQLModel) or be prepared to maintain a fork of this project.","message":"The 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.","severity":"breaking","affected_versions":">=0.15.0"},{"fix":"Upgrade your Python environment to 3.8 or newer.","message":"Support for Python 3.7 was dropped in version 0.14.0, as Python 3.7 reached its End-of-Life.","severity":"breaking","affected_versions":">=0.14.0"},{"fix":"Always execute `prisma db push` or `prisma generate` in your terminal after making changes to `schema.prisma`.","message":"The 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\"`.","severity":"gotcha","affected_versions":"all"},{"fix":"Import `ValidationError` from `pydantic.v1` for error handling related to `prisma.validate` if encountering issues with Pydantic v2.","message":"When 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.","severity":"gotcha","affected_versions":"0.10.0"},{"fix":"Configure your development environment to use `pyright` as the type checker.","message":"Prisma 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.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-04-12T00:00:00.000Z","next_check":"2026-07-11T00:00:00.000Z"}