Skip to contents

By default, ducklake creates and manages its own DuckDB connection. Call this function to make ducklake use a connection you have created instead – for example, a connection you share with duckplyr or other DBI-based tools, or one configured with custom DuckDB settings.

Usage

set_ducklake_connection(conn)

Arguments

conn

A live DuckDB connection created with DBI::dbConnect() and duckdb::duckdb().

Value

The connection, invisibly.

Details

ducklake never closes a connection you supply: detach_ducklake() with shutdown = TRUE and the end-of-session cleanup only shut down connections that ducklake created itself. Closing your connection remains your responsibility.

If ducklake was already managing its own connection, that connection is shut down before yours is registered.

Examples

if (FALSE) { # \dontrun{
conn <- DBI::dbConnect(duckdb::duckdb(), dbdir = "my_analysis.duckdb")
set_ducklake_connection(conn)
attach_ducklake("my_lake", lake_path = "~/lakes/my_lake")
} # }