DESCRIBE VARIABLE

Describes a schema variable, including its type, current value, default, and metadata.

DESCRIBE can be abbreviated to DESC.

See also:

CREATE VARIABLE , ALTER VARIABLE , DROP VARIABLE , SHOW SCHEMA VARIABLES IN SCHEMA

Syntax

DESC[RIBE] VARIABLE <name>

Parameters

name

Specifies the identifier for the variable to describe. The identifier can be qualified with the schema name or with both the database and schema names.

Output

The command returns the following columns:

ColumnData TypeDescription
nameVARCHARName of the variable
data_typeVARCHARDeclared data type of the variable
valueVARCHARCurrent value, or NULL if not set
default_valueVARCHARDefault value, or NULL if no default was declared
versionNUMBERCurrent version number; incremented on each SET
ownerVARCHARRole that owns the variable
commentVARCHARComment for the variable
created_onTIMESTAMP_LTZDate and time when the variable was created
updated_onTIMESTAMP_LTZDate and time when the variable was last modified

Access control requirements

A role used to execute this operation must have the following privileges at a minimum:

PrivilegeObjectNotes
OWNERSHIP, READ, or WRITEVariableAny one of these privileges is sufficient.

For instructions on creating a custom role with a specified set of privileges, see Creating custom roles.

For general information about roles and privilege grants for performing SQL actions on securable objects, see Overview of Access Control.

Usage notes

  • To post-process the output of this command, you can use the pipe operator (->>) or the RESULT_SCAN function. Both constructs treat the output as a result set that you can query.

    For example, you can use the pipe operator or RESULT_SCAN function to select specific columns from the SHOW command output or filter the rows.

    When you refer to the output columns, use double-quoted identifiers for the column names. For example, to select the output column type, specify SELECT "type".

    You must use double-quoted identifiers because the output column names for SHOW commands are in lowercase. The double quotes ensure that the column names in the SELECT list or WHERE clause match the column names in the SHOW command output that was scanned.

Examples

DESCRIBE VARIABLE myschema.tax_rate;
DESC VARIABLE mydb.myschema.api_version;