DROP SOURCE

DROP SOURCE removes a source from Materialize. If there are objects depending on the source, you must explicitly drop them first, or use the CASCADE option.

Syntax

DROP SOURCE IF EXISTS source_name RESTRICT CASCADE
Field Use
IF EXISTS Do not return an error if the named source does not exist.
source_name The name of the source you want to remove.
CASCADE Remove the source and its dependent views.
RESTRICT Do not remove this source if any views depend on it. (Default.)

Examples

Remove a source with no dependent objects

SHOW SOURCES;
...
my_source
DROP SOURCE my_source;

Remove a source with dependent objects

SHOW SOURCES;
...
my_source
DROP SOURCE my_source CASCADE;

Remove a source only if it has no dependent objects

You can use either of the following commands:

  • DROP SOURCE my_source;
    
  • DROP SOURCE my_source RESTRICT;
    

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

DROP SOURCE IF EXISTS my_source;

Privileges

The privileges required to execute this statement are:

  • Ownership of the dropped source.
  • USAGE privileges on the containing schema.
Back to top ↑