prisma/prisma
SqlQueryable / SqlDriverAdapter
The driver adapter contract — what every @prisma/adapter-* package implements and what @prisma/client-engine-runtime calls into. Defined in packages/driver-adapter-utils/src/types.ts.
The hierarchy
graph TD
SQ[SqlQueryable]
SQ --> SDA[SqlDriverAdapter]
SQ --> Tx[Transaction]
SDAFactory[SqlDriverAdapterFactory] -->|connect| SDA
SMA[SqlMigrationAwareDriverAdapterFactory] -->|extends| SDAFactorySqlQueryable
The minimum contract. Provides:
provider: Provider—'mysql' | 'postgres' | 'sqlite' | 'sqlserver'adapterName: string— adapter identifier (used in tracing/SQL Commenter)executeRaw(query: SqlQuery): Promise<number>— fire-and-count statement (returns affected row count)queryRaw(query: SqlQuery): Promise<{ rows, columnNames, columnTypes }>— query that returns rows
Both SqlDriverAdapter and Transaction extend SqlQueryable, which is why QueryInterpreter can run plans inside or outside a transaction with the same code path.
SqlDriverAdapter
Adds:
transactionContext(): Promise<TransactionContext>— used to start an interactive transactiondispose(): Promise<void>— release any underlying connection poolconnectionInfo?(): ConnectionInfo— adapter-supplied metadata
SqlDriverAdapterFactory
Adapters expose factories so the user can configure connection details:
import { PrismaPg } from '@prisma/adapter-pg';
const adapter = new PrismaPg({ connectionString: '...' });
new PrismaClient({ adapter });PrismaPg is a SqlDriverAdapterFactory. Its connect() method returns a SqlDriverAdapter.
SqlMigrationAwareDriverAdapterFactory
Some adapters expose extra hooks Migrate uses for introspection and schema modification. The interface extends SqlDriverAdapterFactory with additional methods.
Transaction
Extends SqlQueryable. Adds:
commit()rollback()createSavepoint(name: string)rollbackToSavepoint(name: string)releaseSavepoint?(name: string)— optional because SQL Server has no release statement
This is a Prisma 7 design: the Transaction interface owns savepoint behavior with async methods, not a savepoint(action, name): SQL method. Adapters own their own SQL dialect.
SqlQuery
The query payload:
sql: string— the SQL text (parameterized with adapter-appropriate placeholders)args: ArgArray— parameter valuesargTypes?: ArgType[]— optional explicit argument types
ConnectionInfo
Adapter-specific metadata that Prisma Client can inspect (e.g., schema name, max identifier length). Lets the engine adjust behavior per database.
See also
- Driver adapters
@prisma/client-engine-runtimefor the consumer- Transactions
- MappedError for the error side of the contract
Built by Factory AutoWiki from public repository content. It is a generated preview for codebase exploration, not source-maintained documentation.