title: "DROP SECRET"
description: "DROP SECRET
removes a secret from Materialize's secret management system."
menu:
main:
parent: 'commands'
DROP SECRET
removes a secret from Materialize's secret management system. If
there are connections depending on the secret, you must explicitly drop them
first, or use the CASCADE
option.
{{< diagram "drop-secret.svg" >}}
Field | Use |
---|---|
IF EXISTS | Do not return an error if the specified secret does not exist. |
secret_name | The secret you want to drop. For available secrets, see SHOW SECRETS . |
CASCADE | Remove the secret and its dependent objects. |
RESTRICT | Do not drop the secret if it has dependencies. (Default) |
To drop an existing secret, run:
DROP SECRET kafka_sasl_password;
To avoid issuing an error if the specified secret does not exist, use the IF EXISTS
option:
DROP SECRET IF EXISTS kafka_sasl_password;
If the secret has dependencies, Materialize will throw an error similar to:
DROP SECRET kafka_sasl_password;
ERROR: cannot drop materialize.public.kafka_sasl_password: still depended upon by catalog
item 'materialize.public.kafka_connection'
, and you'll have to explicitly ask to also remove any dependent objects using the CASCADE
option:
DROP SECRET kafka_sasl_password CASCADE;
The privileges required to execute this statement are:
{{< include-md file="shared-content/sql-command-privileges/drop-secret.md" >}}