DROP CONNECTION

DROP CONNECTION removes a connection from Materialize. If there are sources depending on the connection, you must explicitly drop them first, or use the CASCADE option.

Syntax

DROP CONNECTION IF EXISTS connection_name CASCADE RESTRICT
Field Use
IF EXISTS Do not return an error if the specified connection does not exist.
connection_name The connection you want to drop. For available connections, see SHOW CONNECTIONS.
CASCADE Remove the connection and its dependent objects.
RESTRICT Do not drop the connection if it has dependencies. (Default)

Examples

Dropping a connection with no dependencies

To drop an existing connection, run:

DROP CONNECTION kafka_connection;

To avoid issuing an error if the specified connection does not exist, use the IF EXISTS option:

DROP CONNECTION IF EXISTS kafka_connection;

Dropping a connection with dependencies

If the connection has dependencies, Materialize will throw an error similar to:

DROP CONNECTION kafka_connection;
ERROR:  cannot drop materialize.public.kafka_connection: still depended upon by catalog item
'materialize.public.kafka_source'

, and you’ll have to explicitly ask to also remove any dependent objects using the CASCADE option:

DROP CONNECTION kafka_connection CASCADE;

Privileges

The privileges required to execute this statement are:

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