DESCRIBE TABLE
statementsupportedTables, views, streams, sequencesDescribes either the columns in a table or the set of stage properties for the table (current values and default values). DESCRIBE can be abbreviated to DESC.
Syntax
supportedpartialnot supportednot scored
{ DESCRIBE | DESC } TABLE <name> [ TYPE = { COLUMNS | STAGE } ]
Parameters
| Name | Required | Description |
|---|---|---|
name | Specifies the identifier for the table to describe. If the identifier contains spaces or special characters, the entire string must be enclosed in double quotes. Identifiers enclosed in double quotes are also case-sensitive. | |
TYPE = COLUMNS | STAGE | Specifies whether to display the columns for the table or the set of stage properties for the table (current values and default values). Default: TYPE = COLUMNS |
Usage notes
- This command does not show the object parameters for a table. Instead, use SHOW PARAMETERS IN TABLE.
- DESCRIBE TABLE and DESCRIBE VIEW are interchangeable. Both commands return details for the specified table or view; however, TYPE = STAGE does not apply for views because views do not have stage properties.
- If schema evolution is enabled on the table, the output contains a schema_evolution_record column. This column was introduced with the 2023_08 Bundle (Generally Enabled). For more information, see Enable automatic table schema evolution.
- The output includes a policy name column to indicate the masking policy set directly on the column. If the column is protected by a tag-based masking policy, Snowflake returns NULL. If a masking policy is not set directly on the column or if the Snowflake account is not Enterprise Edition or higher, Snowflake returns NULL.
- The output includes a privacy domain column to indicate the privacy domain set on the column. If a privacy domain is not set on the column or if the Snowflake account is not Enterprise Edition or higher, Snowflake returns NULL.
- 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.
Output
When TYPE = COLUMNS, the command output provides the following properties and metadata: Column | Description name | Name of the column in the table. type | Data type of the column in the table. If collation has been specified for the column, the collation specification is included. kind | The kind of column: COLUMN for regular columns or VIRTUAL for virtual columns defined by an expression. null? | Whether the column accepts NULL values (Y or N). default | The default value for the column, if any (otherwise NULL). primary key | Whether the column is the primary key (or part of a multi-column primary key; Y or N). unique key | Whether the column has a UNIQUE constraint (Y or N). check | Reserved for future use. expression | The SQL expression that defines a virtual column. NULL for non-virtual columns. comment | The comment set for the column, if any (otherwise NULL). policy name | The masking policy set for the column, if any (otherwise NULL). privacy domain | The privacy domain set for the column, if any (otherwise NULL). schema_evolution_record | Records information about the latest triggered Schema Evolution for a given table column. This column contains the following subfields: EvolutionType: The type of the triggered schema evolution (ADD_COLUMN, ADD_FIELD, or DROP_NOT_NULL). EvolutionMode: The triggering ingestion mechanism (COPY, SNOWPIPE, or SNOWPIPE_STREAMING). FileName: The file name that triggered the evolution (NULL for SNOWPIPE_STREAMING). TriggeringTime: The approximate time when the column was evolved. QueryId or PipeId: A unique identifier of the triggering query or pipe (QUERY ID for COPY, PIPE ID for SNOWPIPE, or NULL for SNOWPIPE_STREAMING). Pipe name: Fully qualified pipe name that triggered schema evolution (SNOWPIPE_STREAMING only). Channel name: Channel that triggered schema evolution (SNOWPIPE_STREAMING only). offsetTokenUpperBound: An offset at or before which schema evolution was triggered (SNOWPIPE_STREAMING only). When TYPE = STAGE, the command output provides the current and default values for the table’s stage properties. See Example: Describe stage properties.