20 October 2018        Add to Favorites   Report

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;


GET_DDL( '<object_type>' , '[<namespace>.]<object_name>' )

The object type can be:

  • VIEW
  • FUNCTION (for UDFs)

Read great educational content like this and a lot more !

Members get free exclusive access to content, new courses, and discounts. Signup for a free account to write a post / comment / upvote posts. Creating an account takes less than 5 seconds and you can start earning badges & points too