Prisma
Integration · Prisma
If you already maintain a Prisma schema file, @askdb/prisma reads it directly and produces an AskDB schema artifact. No live database connection during introspection.
When to use it
Section titled “When to use it”- You have a
schema.prismaand want to skip the live-database introspection step. - You’re working in CI, on a laptop without DB access, or in an air-gapped environment.
- You pair it with
@askdb/postgres(or another engine) for the actual SQL dialect at generation time.
Install
Section titled “Install”npm install @askdb/prisma @askdb/introspect# Plus the dialect you want at runtimenpm install @askdb/core @askdb/postgres @ai-sdk/openai@askdb/prisma doesn’t bundle a SQL dialect — pair it with whichever engine package matches your runtime database.
CLI workflow
Section titled “CLI workflow”# Introspect a Prisma schema file (or directory of .prisma files)npx askdb introspect \ --engine prisma \ --prisma-schema ./prisma/schema.prisma \ --out my-app.schema \ --schema-id my-app
# Print the introspection result without writingnpx askdb introspect --engine prisma --prisma-schema ./prisma --print
# Diff against an existing schema artifactnpx askdb introspect --engine prisma --prisma-schema ./prisma --diff my-app.schemaTo make --prisma-schema optional on repeat runs, set introspection.providerConfig.prisma.schemaPath in askdb.config.ts — or rely on auto-discovery: with provider: "prisma" and no path configured, AskDB finds prisma/schema.prisma (or schema.prisma) in your project root automatically.
Programmatic API
Section titled “Programmatic API”import { introspect } from "@askdb/introspect";import { createPrismaConnector } from "@askdb/prisma";
await introspect( { schemaPath: "./prisma", schemaId: "my-app" }, { outDir: "my-app.schema", schemaId: "my-app" }, { connector: createPrismaConnector() },);Supported providers
Section titled “Supported providers”@askdb/prisma supports any Prisma relational provider — at generation time, pair it with the matching AskDB engine adapter:
| Prisma provider | Runtime engine adapter |
|---|---|
postgresql / cockroachdb | @askdb/postgres |
mysql | @askdb/mysql |
sqlite | @askdb/sqlite |
sqlserver | @askdb/sqlserver |
MongoDB is not supported — AskDB targets relational engines.
What it doesn’t do
Section titled “What it doesn’t do”@askdb/prisma is a file-only connector. It does not connect to a database, it does not execute generated SQL, and it does not include a SQL dialect. For SQL generation, supply a dialect from one of the engine packages above.
Read next
Section titled “Read next”© 2026 Yahya Gilany