How to see table structure in Snowflake (SHOW TABLE / VIEW / DDL)
The GET_DDL Statement returns a DDL statement that can be used to recreate the specified object. For databases and schemas, GET_DDL is recursive, i.e. it returns the DDL statements for recreating all supported objects within the specified database/schema
To see Table DDL:
select get_ddl('Table', 'tpch_customer');
To see the view definition:
select get_ddl('view', 'tpch_customer_v');
Or if you simply want to look at the structure, use
Desc table tpch_customer;
Desc view tpch_customer_v;
Syntax:
GET_DDL( '<object_type>' , '[<namespace>.]<object_name>' )
The object type can be:
- DATABASE
- SCHEMA
- TABLE
- VIEW
- SEQUENCE
- FILE_FORMAT
- FUNCTION (for UDFs)
victor
posted on 20 Oct 18Enjoy great content like this and a lot more !
Signup for a free account to write a post / comment / upvote posts. Its simple and takes less than 5 seconds
Post Comment