CREATE SECRET

The CREATE SECRET statement creates a secret.

Syntax

CREATE SECRET secret_name
WITH (option = value[, ...])
  • secret_name — the name of the secret to create.
  • option — command option:
    • value — string with the secret value.
    • inherit_permissions — when enabled, rights on the secret are inherited from the directory where the secret is created. When disabled, only the right DESCRIBE SCHEMA is inherited from the directory. The secret owner gets all possible rights on it in any case. Default is False.

Permissions

Creating a secret requires the right CREATE TABLE.

Examples

Create a secret in the database root named secret_name with value secret_value:

CREATE SECRET secret_name WITH (value = "secret_value");

Create a secret in directory dir in the database root named secret_name with value secret_value. If directory dir does not exist, it will be created:

CREATE SECRET `dir/secret_name` WITH (value = "secret_value");

Create a secret in the database root named secret_name with value secret_value with the same rights as the secret's parent directory:

CREATE SECRET secret_name WITH (value = "secret_value", inherit_permissions = True);

See also