Syntax
Copy DESCRIBE [ RELATION | STREAM | CHANGELOG | MATERIALIZED VIEW ]
COLUMNS fully_qualified_relation_name;
Description
This provides the information about an existing 's columns in a Database's schema . This command can also be used to define a specific Relation type's columns. See LIST RELATIONS for a list of available Relations to describe.
Relations will only be visible if the current has USAGE
privileges on the Database and Schema and SELECT
or INSERT
privilege on the Relation.
Arguments
fully_qualified_relation_name
This is the name of the Relation to describe its columns. For case-sensitive names, the name must be wrapped in double quotes; otherwise, the lowercase name will be used.
The Relation name may optionally be fully qualified in the format of <database_name>.<schema_name>.<relation_name>
or <schema_name>.<relation_name>
. If the Database or Schema name is not provided, then the current session's Database or Schema will be used (see USE ).
Examples
Describe a Stream's columns
Copy demodb.public/demostore# DESCRIBE RELATION COLUMNS pageviews ;
+----------+---------+-----------+-------------+
| Name | Type | Nullable | Properties |
+ ==========+=========+===========+=============+
| viewtime | BIGINT | true | {} |
+----------+---------+-----------+-------------+
| userid | VARCHAR | true | {} |
+----------+---------+-----------+-------------+
| pageid | VARCHAR | true | {} |
+----------+---------+-----------+-------------+
Describe a Stream's columns in a specific Database/Schema
Copy demodb.public/demostore# DESCRIBE RELATION COLUMNS pageviews ;
+----------+---------+-----------+-------------+
| Name | Type | Nullable | Properties |
+ ==========+=========+===========+=============+
| viewtime | BIGINT | true | {} |
+----------+---------+-----------+-------------+
| userid | VARCHAR | true | {} |
+----------+---------+-----------+-------------+
| pageid | VARCHAR | true | {} |
+----------+---------+-----------+-------------+
Describe a Materialized View's columns
The following describes the columns for pvcount
in the demodb
Databae and public
Schema:
Copy demodb.public/demostore# DESCRIBE MATERIALIZED VIEW COLUMNS demodb. "public" .pvcount ;
+-------------+---------+-----------+-------------+
| Name | Type | Nullable | Properties |
+ =============+=========+===========+=============+
| page_name | VARCHAR | true | {} |
+-------------+---------+-----------+-------------+
| pageid | VARCHAR | true | {} |
+-------------+---------+-----------+-------------+
| cnt | BIGINT | false | {} |
+-------------+---------+-----------+-------------+
Describe a Changelog
Copy demodb.public/demostore# DESCRIBE CHANGELOG COLUMNS users_log ;
+--------------+-----------------------+-----------+-------------+
| Name | Type | Nullable | Properties |
+ ==============+=======================+===========+=============+
| registertime | BIGINT | true | {} |
+--------------+-----------------------+-----------+-------------+
| userid | VARCHAR | true | {} |
+--------------+-----------------------+-----------+-------------+
| regionid | VARCHAR | true | {} |
+--------------+-----------------------+-----------+-------------+
| gender | VARCHAR | true | {} |
+--------------+-----------------------+-----------+-------------+
| interests | ARRAY <VARCHAR> | true | {} |
+--------------+-----------------------+-----------+-------------+
| contactinfo | STRUCT < phone VARCHAR | true | {} |
| | , city VARCHAR, | | |
| | "state" VARCHAR, zip | | |
| | code VARCHA R > | | |
+--------------+-----------------------+-----------+-------------+
Describe a Table's columns
Copy demodb.public/demostore# DESCRIBE RELATION COLUMNS pv_agg ;
+-----------+---------+-----------+-------------+
| Name | Type | Nullable | Properties |
+ ===========+=========+===========+=============+
| userid | VARCHAR | true | {} |
+-----------+---------+-----------+-------------+
| pagecount | BIGINT | true | {} |
+-----------+---------+-----------+-------------+
Describe a Relation's columns with a case-sensitive name
Copy demodb.public/demostore# DESCRIBE RELATION "Pageviews" ;
+----------+---------+-----------+-------------+
| Name | Type | Nullable | Properties |
+ ==========+=========+===========+=============+
| viewtime | BIGINT | true | {} |
+----------+---------+-----------+-------------+
| userid | VARCHAR | true | {} |
+----------+---------+-----------+-------------+
| pageid | VARCHAR | true | {} |
+----------+---------+-----------+-------------+