Syntax
Copy 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.
See also DESCRIBE RELATION COLUMNS .
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.
The Relation name optionally be fully qualified in the format <database_name>.<schema_name>.<relation_name>
or <schema_name>.<relation_name>
. If the Database name or Schema name are not provided, then the current session's Database/Schema will be used (see USE
).
Examples
Describe a Relation using a current Database/Schema
The following describes the pageviews
Stream Relation in the current demodb
Database and public
Schema:
Copy demodb.public/demostore# DESCRIBE RELATION pageviews ;
Name | Type | Metadata | Columns | Details | Owner | State | Created at | Updated at
------------+--------+--------------------+------------------+--------------------+----------+---------+----------------------+-----------------------
pageviews | Stream | value.format: json | viewtime BIGINT | store=demostore | sysadmin | Created | 2023-11-08T18:28:57Z | 2023-11-08T18:28:58Z
| | | userid VARCHAR | topic=pageviews | | | |
| | | pageid VARCHAR | primary key=[] | | | |
| | | | | | | |
Describe a Relation
The following describes the pageviews
Stream Relation in the demodb
Database and public
Schema, using its fully qualified Relation name:
Copy demodb.public/demostore# DESCRIBE RELATION demodb.public.pageviews ;
Name | Type | Metadata | Columns | Details | Owner | State | Created at | Updated at
------------+--------+-----------------------------+------------------+---------------------+---------+---------+----------------------+----------------------
pageviews | Stream | value.format: json | viewtime BIGINT | store=demostore | sysadmin | Created | 2023-11-08T18:28:57Z | 2023-11-08T18:28:58Z
| | | userid VARCHAR | topic=pageviews | | | |
| | | pageid VARCHAR | value.format: json | | | |
| | | | primary key=[] | | | |
Describe a Changelog
The following describes the users_log
Changelog in the demodb
Database and public
Schema, using its fully qualified Relation name:
Copy demodb.public/demostore# DESCRIBE RELATION demodb.public.users_log ;
Name | Type | Metadata | Columns | Details | Owner | State | Created at | Updated at
------------+-----------+-------------------------+------------------------------------------------------------------------------------+----------------------+----------+---------+----------------------+-----------------------
users_log | Changelog | value.format: json | registertime BIGINT | store=pubmsk | sysadmin | Created | 2024-01-24T18:50:34Z | 2024-01-24T18:50:36Z
| | key.type: STRUCT<userid | userid VARCHAR | topic=ds_users | | | |
| | VARCHAR> | regionid VARCHAR | primary key=[userid] | | | |
| | topic: users | gender VARCHAR | | | | |
| | store: msk_public | interests ARRAY<VARCHAR> | | | | |
| | primary.key: userid | contactinfo STRUCT<phone VARCHAR, city VARCHAR, "state" VARCHAR, zipcode VARCHAR> | | | | |
| | key.format: json | | | | | |
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:
Copy demodb.public/demostore# DESCRIBE RELATION demodb.public.log_count_mv ;
Name | Type | Metadata | Columns | Details | Owner | State | Created at | Updated at
---------------+------------------+---------------------------+-----------------+----------------------+----------+---------+----------------------+-----------------------
log_count_mv | MaterializedView | key.type: STRUCT<"userid" | userid VARCHAR | indexes=[] | sysadmin | Created | 2024-06-14T00:32:25Z | 2024-06-14T00:32:26Z
| | VARCHAR> | cnt BIGINT | primary key=[userid] | | | |
| | primary.key: userid | | | | | |
| | | | | | | |
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:
Copy demodb.public/demostore# DESCRIBE RELATION demodb.analytics.total_views ;
Name | Type | Metadata | Columns | Details | Owner | State | Created at | Updated at
------------+--------+-----------------------------+------------------+---------------------+---------+---------+----------------------+----------------------
total_views | Stream | value.format: json | viewtime BIGINT | store=demostore | sysadmin | Created | 2023-11-08T18:28:57Z | 2023-11-08T18:28:58Z
| | | userid VARCHAR | topic=pageviews | | | |
| | | pageid VARCHAR | value.format: json | | | |
| | | | primary key=[] | | | |
Describe a Table
The following describes the pv_agg
Table in the current Database and Schema:
Copy 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:
Copy demodb.public/demostore# DESCRIBE RELATION "Pageviews" ;
Name | Type | Metadata | Columns | Details | Owner | State | Created at | Updated at
------------+--------+-----------------------------+------------------+---------------------+---------+---------+----------------------+----------------------
Pageviews | Stream | value.format: json | viewtime BIGINT | store=demostore | sysadmin | Created | 2023-11-08T18:28:57Z | 2023-11-08T18:28:58Z
| | | userid VARCHAR | topic=pageviews | | | |
| | | pageid VARCHAR | value.format: json | | | |
| | | | primary key=[] | | | |