DESCRIBE RELATION

Syntax

DESCRIBE { RELATION | STREAM | CHANGELOG | MATERIALIZED VIEW } relation_name;

Description

This provides the structure, metadata, and properties of an existing Relation in a Database's schema. This command can also be used to define a specific Relation type. See LIST RELATIONS for a list of available Relations to describe.

This command can be used to inspect how a Relation is structured, including its serialization format and where it is physically connected to when managing Stores. The output of this command also provides the properties that were included at creation time and/or injected by the system for optimal operation.

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

relation_name

This is the name of the Relation to describe. For case-sensitive names, the name must be wrapped in double quotes; otherwise, the lowercase name will be used.

Examples

Describe a Relation using a current Database/Schema

The following describes the pageviews Stream Relation in the current demodb Database and public Schema:

demodb.public/demostore# DESCRIBE RELATION pageviews;
    Name    |  Type  |                           Metadata                           |                 Columns                  |      Details       | Primary key |  Owner   |      Created at      |      Updated at       
------------+--------+--------------------------------------------------------------+------------------------------------------+--------------------+-------------+----------+----------------------+-----------------------
  pageviews | Stream | {store : demostore,topic : pageviews,value.format : json}    | viewtime  BIGINT                         | store=demostore    |             | sysadmin | 2023-01-12T20:39:02Z | 2023-01-12T20:39:02Z  
            |        |                                                              | userid  VARCHAR                          | topic=pageviews    |             |          |                      |                       
            |        |                                                              | pageid  VARCHAR                          |                    |             |          |                      |                       

Describe a Relation

The following describes the pageviews Stream Relation in the demodb Database and public Schema, using its fully qualified Relation name:

demodb.public/demostore# DESCRIBE RELATION demodb.public.pageviews;
    Name    |  Type  |                           Metadata                           |                 Columns                  |      Details       | Primary key |  Owner   |      Created at      |      Updated at       
------------+--------+--------------------------------------------------------------+------------------------------------------+--------------------+-------------+----------+----------------------+-----------------------
  pageviews | Stream | {store : demostore,topic : pageviews,value.format : json}    | viewtime  BIGINT                         | store=demostore    |             | sysadmin | 2023-01-12T20:39:02Z | 2023-01-12T20:39:02Z  
            |        |                                                              | userid  VARCHAR                          | topic=pageviews    |             |          |                      |                       
            |        |                                                              | pageid  VARCHAR                          |                    |             |          |                      |                       

Describe a Changelog

The following describes the users_log Changelog in the demodb Database and public Schema, using its fully qualified Relation name:

demodb.public/demostore# DESCRIBE CHANGELOG demodb.public.users_log;
    Name    |   Type    |                                                              Metadata                                                              |                                      Columns                                       | Details | Primary key |  Owner   |      Created at      |      Updated at       
------------+-----------+------------------------------------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------+---------+-------------+----------+----------------------+-----------------------
  users_log | Changelog | {store : msk_public,topic : ds_users,value.format : json,key.format : json,key.type : STRUCT<userid VARCHAR>,primary.key : userid} | registertime  BIGINT                                                               |         | userid      | sysadmin | 2023-01-12T20:41:00Z | 2023-01-12T20:41:00Z  
            |           |                                                                                                                                    | userid  VARCHAR                                                                    |         |             |          |                      |                       
            |           |                                                                                                                                    | regionid  VARCHAR                                                                  |         |             |          |                      |                       
            |           |                                                                                                                                    | gender  VARCHAR                                                                    |         |             |          |                      |                       
            |           |                                                                                                                                    | interests  ARRAY<VARCHAR>                                                          |         |             |          |                      |                       
            |           |                                                                                                                                    | contactinfo  STRUCT<phone VARCHAR, city VARCHAR, "state" VARCHAR, zipcode VARCHAR> |         |             |          |                      |                       

Describe a Materialized View

The following describes the users_log Materialized View in the demodb Database and public Schema, using its fully qualified Relation name:

demodb.public/demostore# DESCRIBE MATERIALIZED VIEW demodb.public.log_count_mv;
       Name      |   Type    |                                                                         Metadata                                                                         |                 Columns                  | Details | Primary key  |  Owner   |      Created at      |      Updated at       
-----------------+-----------+----------------------------------------------------------------------------------------------------------------------------------------------------------+------------------------------------------+---------+--------------+----------+----------------------+-----------------------
  log_count_mv   | Changelog | {value.format : json,key.format : json,key.type : STRUCT<"top_interest" VARCHAR>,primary.key : top_interest,store : demostore,topic : log_count}         | u_count  BIGINT                          |         | top_interest | sysadmin | 2023-01-12T20:47:28Z | 2023-01-12T20:47:28Z  
                 |           |                                                                                                                                                          | top_interest  VARCHAR                    |         |              |          |                      |                       

Describe a Stream in a specific Database/Schema

The following describes the total_views Stream in the demodb Database and analytics Schema, using its fully qualified Relation name:

demodb.public/demostore# DESCRIBE RELATION demodb.analytics.total_views;
     Name     |  Type  |                           Metadata                           |                 Columns                  |      Details       | Primary key |  Owner   |      Created at      |      Updated at       
--------------+--------+--------------------------------------------------------------+------------------------------------------+--------------------+-------------+----------+----------------------+-----------------------
  total_views | Stream | {store : demostore,topic : pageviews,value.format : json}    | viewtime  BIGINT                         | store=demostore    |             | sysadmin | 2023-02-10T21:48:21Z | 2023-02-10T21:48:21Z  
              |        |                                                              | userid  VARCHAR                          | topic=pageviews    |             |          |                      |                       
              |        |                                                              | pageid  VARCHAR                          |                    |             |          |                      |                       

Describe a Table

The following describes the pv_agg Table in the current Database and Schema:

demodb.public/demostore# DESCRIBE TABLE pv_agg;
   Name  | Type  |                                                                                                                    Metadata                                                                                          |                 Columns                  | Details |  Owner   |      Created at      |      Updated at
---------+-------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------------------------------------+---------+----------+----------------------+-----------------------
  pv_agg | Table | {databricks.catalog.name : deltastream_databricks1,databricks.schema.name : schema1,databricks.table.name : pv_agg,primary.key : userid,store : databricks_store,table.data.file.location : s3://some_bucket/pv_agg} | userid  VARCHAR                          |         | sysadmin | 2023-09-18T15:30:55Z | 2023-09-18T15:30:56Z
         |       |                                                                                                                                                                                                                      | pagecount  BIGINT                        |         |          |                      |

Describe a Relation with a case-sensitive name

The following describes the Pageviews Stream Relation in the current demodb Database and public Schema:

demodb.public/demostore# DESCRIBE RELATION "Pageviews";
    Name    |  Type  |                           Metadata                           |                 Columns                  |      Details       | Primary key |  Owner   |      Created at      |      Updated at       
------------+--------+--------------------------------------------------------------+------------------------------------------+--------------------+-------------+----------+----------------------+-----------------------
  Pageviews | Stream | {store : demostore,topic : pageviews,value.format : json}    | viewtime  BIGINT                         | store=demostore    |             | sysadmin | 2023-01-12T20:39:02Z | 2023-01-12T20:39:02Z  
            |        |                                                              | userid  VARCHAR                          | topic=pageviews    |             |          |                      |                       
            |        |                                                              | pageid  VARCHAR                          |                    |             |          |                      |                       

Last updated