Overview

The SQLite data source connector connects Prisma to a SQLite database file. These files always have the file ending .db (e.g.: dev.db).

Example

To connect to a SQLite database file, you need to configure a datasource block in your schema file:

1datasource sqlite {
2 provider = "sqlite"
3 url = "file:./dev.db"
4}

The fields passed to the datasource block are:

  • provider: Specifies the sqlite data source connector.
  • url: Specifies the connection URL for the SQLite database. The connection URL always starts with the prefix file: and then contains a file path pointing to the SQLite database file. In this case, the file is located in the same directory and called dev.db.

Data model mapping

The SQLite connector maps the scalar types from the data model to native column types as follows:

Data modelSQLite
StringTEXT
BooleanBOOLEAN
IntINTEGER
FloatREAL

Connection details

Connection URL

The connection URL of a SQLite connector points to a file on your file system. For example, the following two paths are equivalent because the .db iss in the same directory:

1datasource sqlite {
2 provider = "sqlite"
3 url = "file:./dev.db"
4}

is the same as:

1datasource sqlite {
2 provider = "sqlite"
3 url = "file:dev.db"
4}

You can also target files from the root or any other place in your file system:

1datasource sqlite {
2 provider = "sqlite"
3 url = "file:/Users/janedoe/dev.db"
4}
Edit this page on Github