Skip to contents

Detaches the DuckLake database but keeps the DuckDB connection alive by default. Use shutdown = TRUE to also close the connection and release file locks.

Usage

detach_ducklake(ducklake_name = NULL, shutdown = FALSE)

Arguments

ducklake_name

Optional name of the ducklake to detach.

shutdown

If TRUE, shut down the DuckDB connection after detaching. Only applies to the connection ducklake created itself; a connection registered with set_ducklake_connection() is never closed for you.

Value

Invisibly, NULL. Called for its side effect of detaching the catalog from the package's DuckDB connection.

Examples

lake_dir <- tempfile("detach_lake_")
dir.create(lake_dir)
attach_ducklake("detach_lake", lake_path = lake_dir)
# ... do work ...
detach_ducklake("detach_lake")

# Full shutdown when completely done
attach_ducklake("detach_lake", lake_path = lake_dir)
detach_ducklake("detach_lake", shutdown = TRUE)
unlink(lake_dir, recursive = TRUE)