DESCRIBE RELATION COLUMNS

Syntax

DESCRIBE [ RELATION | STREAM | CHANGELOG | MATERIALIZED VIEW ]
COLUMNS fully_qualified_relation_name;

Description

This provides the information about an existing DeltaStream Object'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 are visible only 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. If the name is case-sensitive you must wrap it in double quotes; otherwise, the system uses the lowercase name.

Optionally, the relation name may 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, the system uses the current session's database or schema (see USE).

Examples

Describe a Stream's columns

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:

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 database and public schema:

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:

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 VARCHAR>         |           |             |
+--------------+-----------------------+-----------+-------------+

Describe a Table's columns

The following describes the columns for pv_agg Table in the current database and schema:

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:

demodb.public/demostore# DESCRIBE RELATION "Pageviews";
+----------+---------+-----------+-------------+
|  Name    |  Type   |  Nullable |  Properties |
+==========+=========+===========+=============+
| viewtime | BIGINT  | true      | {}          |
+----------+---------+-----------+-------------+
| userid   | VARCHAR | true      | {}          |
+----------+---------+-----------+-------------+
| pageid   | VARCHAR | true      | {}          |
+----------+---------+-----------+-------------+

Last updated