View Object Creation Statement (SHOW CREATE TABLE)
Description
The SHOW CREATE TABLE command is used to obtain the DDL creation statement of a specified Lakehouse object, supporting regular tables, external tables, materialized views, dynamic tables, and views.
Syntax
Parameters
| Parameter | Required | Description |
|---|---|---|
schema_name | No | Specifies the schema name. If not specified, defaults to the current schema |
object_name | Yes | The name of the object to query, which can be a table, external table, materialized view, dynamic table, or view |
Return Columns
| Column | Description |
|---|---|
sql | The complete DDL creation statement of the object, including workspace and schema prefixes |
Examples
Example 1: View the Creation Statement of an External Table
Result:
Example 2: View the Creation Statement of a Materialized View
Result:
Example 3: View the Creation Statement of a Regular View
Result:
Notes
- The returned DDL statement includes the full three-level namespace of
workspace.schema.object_name, and can be used directly to recreate the object in another workspace or schema (with the corresponding namespace modified). - For external tables, the returned statement includes
LOCATIONandCONNECTIONinformation. When migrating, ensure that the corresponding connection configuration exists in the target environment. - This command does not support viewing creation statements for regular internal tables; it only supports external tables, views, materialized views, and dynamic tables.
Related Commands
- CREATE EXTERNAL TABLE: Create an external table
- CREATE VIEW: Create a view
- CREATE MATERIALIZED VIEW: Create a materialized view
- SHOW TABLES WHERE is_external=true: List all external tables
