duckdb

The duckdb connection can be used to access a DuckDB database.

connection "duckdb" "duckdb_connection" {
filename = "my_ducks.db"
}

Arguments

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

All arguments are optional, and a duckdb 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 duckdb://path/to/file

Default Connection

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

connection "duckcb" "default" {
filename = env("DUCKDB_FILENAME")
}