dr_open_lake()
Creates or reopens a self-contained local folder. DuckDB is the default and
needs no extension download or external service. Use
backend = "ducklake"
for an actual DuckLake. Backend and ordered layers (including named roles)
are remembered in dataraft.json; reopening never silently switches them.
A new lake needs an empty or nonexistent folder. Existing lakes made with
custom remote or split-location configuration still open through
dr_connect_lake(). Use dr_lake_config() for a connection-free definition.
Usage
dr_open_lake(
path = "dataraft",
backend = NULL,
read_only = FALSE,
layers = NULL,
install_extensions = TRUE
)
dr_close_lake(lake)Arguments
- path
- Local folder, created if needed. Defaults to
"dataraft"in the working directory. - backend
- Optional
"duckdb"or"ducklake". DuckLake requires its DuckDB extension. Defaults to the saved choice, or DuckDB for a new folder. - read_only
- Open an existing lake without registry or data writes.
- layers
- Layer names, optionally named by role. For a new folder the
default is
c("raw", "validated", "products"). Omit on subsequent opens to reuse saved layers. Explicit conflicting settings are rejected. - install_extensions
- Allow installation of required DuckDB extensions.
Use
FALSEwhen the required extensions are already installed. - lake
- Connected lake to close.
Value
dr_open_lake() returns a connected dr_lake. dr_close_lake() invisibly
returns TRUE; it is an alias for dr_disconnect_lake().
Details
Read-only opens never update the folder configuration.
Examples
\dontshow{if (requireNamespace("duckdb", quietly = TRUE)) withAutoprint(\{ # examplesIf}
root <- tempfile("dataraft-")
lake <- dr_open_lake(root)
dr_write_data(lake, data.frame(id = 1:2), "orders")
dr_read_release(lake, "orders")
dr_close_lake(lake)
lake <- dr_open_lake(root) # reopens the same data
dr_read_release(lake, "orders")
dr_close_lake(lake)
unlink(root, recursive = TRUE)
\dontshow{\}) # examplesIf}See also
Documentation source snapshot · View source at 113c179 ↗
Code examples are documented source examples; they are not executed in this website build.
Code examples are documented source examples; they are not executed in this website build.