Skip to contents

Removes a schema with DROP SCHEMA. By default the schema must be empty; cascade = TRUE drops its tables and views with it. Like every change, the drop is a snapshot, so the tables stay reachable through time travel.

Usage

drop_schema(schema_name, cascade = FALSE, ducklake_name = NULL)

Arguments

schema_name

Name of the schema.

cascade

Also drop the tables and views in the schema (default FALSE).

ducklake_name

Optional name of the attached DuckLake catalog. If NULL, the current database is used.

Value

Invisibly, NULL.

Examples

lake_dir <- tempfile("dropschema_lake_")
dir.create(lake_dir)
attach_ducklake("dropschema_lake", lake_path = lake_dir)

create_schema("scratch")
#> Created schema "scratch".
create_table(mtcars, "scratch.cars")
drop_schema("scratch", cascade = TRUE)
#> Dropped schema "scratch".

detach_ducklake("dropschema_lake", shutdown = TRUE)
unlink(lake_dir, recursive = TRUE)