DROP SECRET

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.

Syntax

DROP SECRET IF EXISTS secret_name CASCADE RESTRICT
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)

Examples

Dropping a secret with no dependencies

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;

Dropping a secret with dependencies

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;

Privileges

The privileges required to execute this statement are:

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