Materialize Documentation
Join the Community github/materialize

DROP SCHEMA

DROP SCHEMA removes a schema from your Materialize instances.

Syntax

DROP SCHEMA IF EXISTS schema_name CASCADE RESTRICT
Field Use
IF EXISTS Do not return an error if the named schema does not exist.
schema_name The schema you want to remove. For available schemas, see SHOW SCHEMAS.
CASCADE Remove the schema and its dependent objects.
RESTRICT Do not remove this schema if it contains any sources or views. (Default)

Details

Before you can drop a schema, you must drop all sources and views it contains, or use the CASCADE option.

Example

Remove a schema with no dependent objects

SHOW SOURCES FROM my_schema;
my_file_source
DROP SCHEMA my_schema;

Remove a schema with dependent objects

SHOW SOURCES FROM my_schema;
my_file_source
DROP SCHEMA my_schema CASCADE;

Remove a schema only if it has no dependent objects

You can use either of the following commands:

Do not issue an error if attempting to remove a nonexistent schema

DROP SCHEMA IF EXISTS my_schema;
Did this info help?
Yes No