Schemas group the tables of a lake, and are the natural home for
medallion layers (bronze, silver, gold) or per-study areas. Every
function that takes a table name accepts "schema.table", and
list_ducklake_tables() shows each table's schema. DuckLake writes a
schema's data files under a directory of their own, which is what
path-based access control on object storage keys on.
Examples
lake_dir <- tempfile("schema_lake_")
dir.create(lake_dir)
attach_ducklake("schema_lake", lake_path = lake_dir)
# One schema per medallion layer
create_schema("bronze")
#> Created schema "bronze".
create_schema("silver")
#> Created schema "silver".
create_table(mtcars, "bronze.cars")
get_ducklake_table("bronze.cars") |>
dplyr::filter(cyl == 4) |>
create_table("silver.cars")
list_ducklake_tables()
#> schema_name table_name type
#> 1 bronze cars table
#> 2 silver cars table
detach_ducklake("schema_lake", shutdown = TRUE)
unlink(lake_dir, recursive = TRUE)
