sqlite

The sqlite connection can be used to access a SQLite database.

connection "sqlite" "sqlite_connection" {
filename = "./my_sqlite_db.db"
}

Arguments

NameTypeRequired?Description
filenameStringOptionalPath to a SQLite database file to open. The filename is relative to the mod location

All arguments are optional, and a sqlite connection with no arguments will behave the same as the default connection.

Attributes (Read-Only)

AttributeTypeDescription
connection_stringStringThe connection string built from the arguments to this connection, in the format sqlite://path/to/file

Default Connection

The sqlite connection type includes an implicit, default connection (connection.sqlite.default), which will use the SQLITE_FILENAME environment variable unless overridden.

connection "sqlite" "default" {
file = env("SQLITE_FILENAME")
}