DESCRIBE Statements

    Java

    DESCRIBE statements can be executed with the method of the TableEnvironment. The executeSql() method returns the schema of given table for a successful DESCRIBE operation, otherwise will throw an exception.

    The following examples show how to run a DESCRIBE statement in TableEnvironment.

    Scala

    DESCRIBE statements can be executed with the executeSql() method of the TableEnvironment. The executeSql() method returns the schema of given table for a successful DESCRIBE operation, otherwise will throw an exception.

    The following examples show how to run a DESCRIBE statement in TableEnvironment.

    DESCRIBE statements can be executed with the execute_sql() method of the TableEnvironment. The execute_sql() method returns the schema of given table for a successful DESCRIBE operation, otherwise will throw an exception.

    The following examples show how to run a DESCRIBE statement in TableEnvironment.

    SQL CLI

    DESCRIBE statements can be executed in SQL CLI.

    The following examples show how to run a DESCRIBE statement in SQL CLI.

    Java

    1. val tableEnv = TableEnvironment.create(...)
    2. // register a table named "Orders"
    3. tableEnv.executeSql(
    4. "CREATE TABLE Orders (" +
    5. " `user` BIGINT NOT NULl," +
    6. " product VARCHAR(32)," +
    7. " amount INT," +
    8. " ts TIMESTAMP(3)," +
    9. " ptime AS PROCTIME()," +
    10. " PRIMARY KEY(`user`) NOT ENFORCED," +
    11. " WATERMARK FOR ts AS ts - INTERVAL '1' SECONDS" +
    12. ") with (...)")
    13. // print the schema
    14. // print the schema
    15. tableEnv.executeSql("DESC Orders").print()

    Python

    1. table_env = TableEnvironment.create(...)
    2. table_env.execute_sql( \
    3. "CREATE TABLE Orders ("
    4. " `user` BIGINT NOT NULl,"
    5. " product VARCHAR(32),"
    6. " amount INT,"
    7. " ts TIMESTAMP(3),"
    8. " ptime AS PROCTIME(),"
    9. " PRIMARY KEY(`user`) NOT ENFORCED,"
    10. " WATERMARK FOR ts AS ts - INTERVAL '1' SECONDS"
    11. ") with (...)");
    12. # print the schema
    13. table_env.execute_sql("DESCRIBE Orders").print()
    14. # print the schema
    15. table_env.execute_sql("DESC Orders").print()

    SQL CLI

    The result of the above example is:

    Java

    1. +---------+----------------------------------+-------+-----------+-----------------+----------------------------+
    2. | name | type | null | key | computed column | watermark |
    3. +---------+----------------------------------+-------+-----------+-----------------+----------------------------+
    4. | product | VARCHAR(32) | true | | | |
    5. | amount | INT | true | | | |
    6. | ptime | TIMESTAMP(3) NOT NULL *PROCTIME* | false | | PROCTIME() | |
    7. +---------+----------------------------------+-------+-----------+-----------------+----------------------------+
    8. 5 rows in set

    Scala

    1. +---------+----------------------------------+-------+-----------+-----------------+----------------------------+
    2. | name | type | null | key | computed column | watermark |
    3. +---------+----------------------------------+-------+-----------+-----------------+----------------------------+
    4. | user | BIGINT | false | PRI(user) | | |
    5. | product | VARCHAR(32) | true | | | |
    6. | amount | INT | true | | | |
    7. | ts | TIMESTAMP(3) *ROWTIME* | true | | | `ts` - INTERVAL '1' SECOND |
    8. | ptime | TIMESTAMP(3) NOT NULL *PROCTIME* | false | | PROCTIME() | |
    9. +---------+----------------------------------+-------+-----------+-----------------+----------------------------+
    10. 5 rows in set

    Python

    1. root
    2. |-- user: BIGINT NOT NULL
    3. |-- product: VARCHAR(32)
    4. |-- amount: INT
    5. |-- ts: TIMESTAMP(3) *ROWTIME*
    6. |-- ptime: TIMESTAMP(3) NOT NULL *PROCTIME* AS PROCTIME()
    7. |-- WATERMARK FOR ts AS `ts` - INTERVAL '1' SECOND
    8. |-- CONSTRAINT PK_3599338 PRIMARY KEY (user)

    Syntax