streamtasksnowflake-cloud-data-platform

Can a snowflake stream trigger a task without adding any schedule?


I have a stream created in snowflake and a task which moves stream data into another table. I want the task to execute automatically every time there is new data in stream. How to automatically trigger the task when there is new data in stream?


Solution

  • Tasks can only triggered on a schedule but you can have them run as often as every minute

    If a run takes more than 1 minute, then the next task is delayed until 1 min after the previous task finishes

    While it is not "on demand" a task running every minute should suffice for most situations. Of course it means a warehouse constantly running but the same would be true for an on demand service assuming new data arrives all the time. If data is irregular, you can add a stream has data check so the task does not run if there is no data: https://docs.snowflake.com/en/sql-reference/functions/system_stream_has_data.html