Search code examples
snowflake-cloud-data-platformsnowflake-task

How do you get DDL of a task in Snowflake?


In Snowflake, you can use the get_ddl function like this to get ddl for tables, views and procedures:

select get_ddl('view', 'SOME_VIEW_I_CREATED')

But it doesn't seem you can do this with tasks.

Is there any way to easily get DDL for snowflake tasks?

NOTE: get_ddl is now supported in tasks in snowflake.


Solution

  • As of at least 2019-12-24 (when I discovered it), you can now do this:

    select get_ddl('task', 'demo_task')
    

    In order to run this, you have to have the following permissions:

    (USAGE on db & OWNERSHIP on schema & Any Permission on task) OR
    (USAGE on db & USAGE on schema & Any Permission on task)