title: "DROP CONNECTION"
description: "DROP CONNECTION
removes a connection from Materialize."
menu:
main:
parent: 'commands'
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.
{{< diagram "drop-connection.svg" >}}
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) |
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;
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;
The privileges required to execute this statement are:
{{< include-md file="shared-content/sql-command-privileges/drop-connection.md"
}}