Syntax
Copy DESCRIBE [ RELATION | STREAM | CHANGELOG | MATERIALIZED VIEW ]
COLUMNS fully_qualified_relation_name;
Description
This provides the information about an existing Relation '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 Role 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
The following describes the total_views
Stream Relation columns in the demodb
Database and analytics
Schema, using its fully qualified Relation name:
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
The following describes the users_log
Changelog in the current Database and Schema:
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
The following describes the columns for pv_agg
Table in the current Database and Schema:
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
The following describes the columns for Pageviews
Stream Relation in the current demodb
Database and public
Schema:
Copy demodb.public/demostore# DESCRIBE RELATION "Pageviews" ;
+----------+---------+-----------+-------------+
| Name | Type | Nullable | Properties |
+ ==========+=========+===========+=============+
| viewtime | BIGINT | true | {} |
+----------+---------+-----------+-------------+
| userid | VARCHAR | true | {} |
+----------+---------+-----------+-------------+
| pageid | VARCHAR | true | {} |
+----------+---------+-----------+-------------+
Last updated 3 months ago