Get started
 Overview  PostgreSQL  MySQL  SQLite Manage schema
 Overview  Column types  Indexes & Constraints  Sequences  Migrations  Views  Schemas  Extensions Access your data
 Query  Select  Insert  Update  Delete  Filters  Joins  Magic sql`` operator Performance
 Queries  Serverless Advanced
 Set Operations  Generated Columns  Transactions  Batch  Dynamic query building  Read Replicas  Custom types  Goodies Extensions
 Prisma  ESLint Plugin  drizzle-zod  drizzle-typebox  drizzle-valibot  drizzle-graphql  Drizzle extension for Prisma
If you have an existing project with Prisma and want to try Drizzle or gradually adopt it, you can use our first-class extension that will add Drizzle API to your Prisma client. It will allow you to use Drizzle alongside your Prisma queries reusing your existing DB connection.
How to use
Install dependencies
You need to install Drizzle itself and a generator package that will create Drizzle schema from the Prisma schema.
 npm 
 yarn 
 pnpm 
 bun 
 npm i drizzle-orm@latest
npm i -D drizzle-prisma-generatoryarn add drizzle-orm@latest
yarn add -D drizzle-prisma-generatorpnpm add drizzle-orm@latest
pnpm add -D drizzle-prisma-generatorbun add drizzle-orm@latest
bun add -D drizzle-prisma-generatorUpdate your Prisma schema
Add Drizzle generator to your Prisma schema. output is the path where generated Drizzle schema TS files will be placed.
generator client {
  provider = "prisma-client-js"
}
generator drizzle {
  provider = "drizzle-prisma-generator"
  output   = "./drizzle" // Where to put generated Drizle tables
}
// Rest of your Prisma schema
datasource db {
  provider = "postgresql"
  url      = env("DB_URL")
}
model User {
  id    Int     @id @default(autoincrement())
  email String  @unique
  name  String?
}
...Generate Drizzle schema
prisma generateAdd Drizzle extension to your Prisma client
PostgreSQL
MySQL
SQLite
 import { PrismaClient } from '@prisma/client';
import { drizzle } from 'drizzle-orm/prisma/pg';
const prisma = new PrismaClient().$extends(drizzle());import { PrismaClient } from '@prisma/client';
import { drizzle } from 'drizzle-orm/prisma/mysql';
const prisma = new PrismaClient().$extends(drizzle());import { PrismaClient } from '@prisma/client';
import { drizzle } from 'drizzle-orm/prisma/sqlite';
const prisma = new PrismaClient().$extends(drizzle());Run Drizzle queries via prisma.$drizzle ✨
In order to use Drizzle query builder, you need references to Drizzle tables. You can import them from the output path that you specified in the generator config.
import { User } from './drizzle';
await prisma.$drizzle.insert().into(User).values({ email: 'sorenbs@drizzle.team', name: 'Søren' });
const users = await prisma.$drizzle.select().from(User);Limitations
- Relational queries are not supported due to a Prisma driver limitation. Because of it, Prisma unable to return query results in array format, which is required for relational queries to work.
- In SQLite, .values()(e.g.await db.select().from(table).values()) is not supported, because of the same reason as above.
- Prepared statements support is limited - .prepare()will only build the SQL query on Drizzle side, because there is no Prisma API for prepared queries.