DESCRIBE Statement¶
Confluent Cloud for Apache Flink®️ enables viewing the schema of an Apache Kafka® topic.
Syntax¶
{ DESCRIBE | DESC } [EXTENDED] [catalog_name.][db_name.]table_name
Description¶
The DESCRIBE statement shows the following properties of a table:
- Columns and their data type, including nullability constraints
- Primary keys
- Bucket keys, i.e., keys of distribution
- Implicit NOT NULL for primary key columns
- Custom watermarks
The DESCRIBE EXTENDED statement shows all of the properties from the DESCRIBE
statement and also shows system columns, like $rowtime
, including the
system watermark.
Example¶
In the Flink SQL shell or in a Cloud Console workspace, run the following commands to see an example of the DESCRIBE statement.
Create a table.
CREATE TABLE orders ( `user` BIGINT NOT NULL, product STRING, amount INT, ts TIMESTAMP(3), PRIMARY KEY(`user`) NOT ENFORCED );
Your output should resemble:
[INFO] Execute statement succeed.
View the table’s schema.
DESCRIBE orders;
Your output should resemble:
+-------------+--------------+----------+-------------------------+ | Column Name | Data Type | Nullable | Extras | +-------------+--------------+----------+-------------------------+ | user | BIGINT | NOT NULL | PRIMARY KEY, BUCKET KEY | | product | STRING | NULL | | | amount | INT | NULL | | | ts | TIMESTAMP(3) | NULL | | +-------------+--------------+----------+-------------------------+
View the table’s schema and system columns.
DESCRIBE EXTENDED orders;
Your output should resemble:
+-------------+----------------------------+----------+-----------------------------------------------------+---------+ | Column Name | Data Type | Nullable | Extras | Comment | +-------------+----------------------------+----------+-----------------------------------------------------+---------+ | user | BIGINT | NOT NULL | PRIMARY KEY, BUCKET KEY | | | product | STRING | NULL | | | | amount | INT | NULL | | | | ts | TIMESTAMP(3) | NULL | | | | $rowtime | TIMESTAMP_LTZ(3) *ROWTIME* | NOT NULL | METADATA VIRTUAL, WATERMARK AS `SOURCE_WATERMARK`() | SYSTEM | +-------------+----------------------------+----------+-----------------------------------------------------+---------+