Learn R Programming

motherduck (version 0.2.0)

delete_schema: Drop a Schema from a Database

Description

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)

Value

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

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.

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.

See Also

Other db-manage: alter_table_schema(), copy_tables_to_new_location(), create_database(), create_if_not_exists_share(), create_or_replace_share(), create_schema(), create_table(), delete_and_create_schema(), delete_database(), delete_table(), describe_share(), drop_share(), list_owned_shares(), list_shared_with_me_shares(), upload_database_to_md()