This page describes the Prisma Client constructor parameters. Parameters are validated at runtime.


Use the datasources constructor parameter to programatically override the URL of a datasource - for example, as part of an integration test. To override a datasource:

  1. Define a datasource in the schema.prisma file. In the following example, there is a single datasource named my_database:

    datasource my_database {
    provider = "sqlite"
    url = env("DATABASE_URL")

    The DATABASE_URL environment variable defines the following value:


    Note: You must re-generate the Prisma Client each time you add or rename a datasource. Datasource names are included in the generated client.

  2. Instantiate a client and override the connection string of the my_database datasource:

    import { PrismaClient } from '@prisma/client'
    const prisma = new PrismaClient({
    datasources: {
    my_database: {
    url: 'file:./dev_qa.db'

Note: If you define multiple datasources in schema.prisma, Prisma defaults to the first entry.

See Datasources for more information.


Use the log constructor parameter to determine the type and level of logging. The following configuration raises an event each time the Prisma Client queries the database:

const prisma = new PrismaClient({
log: [{ emit: 'event', level: 'query' }],

See Logging for more information.


Use the errorFormat constructor parameter to determine the level and formatting of errors returned by Prisma. The following configuration outputs raw error messages without formatting or extended information about the error:

const prisma = new PrismaClient({
errorFormat: 'minimal', // Defaults to 'colorless'

See Error formatting for more information.

Edit this page on GitHub