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.
Arguments
- conn
A live DuckDB connection created with DBI::dbConnect() and
duckdb::duckdb().
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.
See also
Other connection management:
attach_ducklake(),
detach_ducklake(),
get_ducklake_backend(),
get_ducklake_connection(),
install_ducklake()
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")
} # }
