Skip to contents

Drops a schema from a specified database. Optionally cascades the deletion to all objects within the schema. Prints helpful CLI information about the current connection and action.

Usage

delete_schema(.con, database_name, schema_name, cascade = FALSE)

Arguments

.con

A valid `DBI` connection (DuckDB / MotherDuck).

database_name

Name of the database containing the schema.

schema_name

Name of the schema to drop.

cascade

Logical; if `TRUE` (default), use `CASCADE` to drop all dependent objects in the schema. If `FALSE`, drop only if empty.

Value

Invisibly returns `NULL`. Side effect: drops the schema (and contained objects if `cascade = TRUE`) and prints CLI status.

Details

- Runs `DROP SCHEMA IF EXISTS <db>.<schema>` with optional `CASCADE`. - Intended for DuckDB or MotherDuck connections. - Uses CLI helpers to show current connection and report the deletion.