coool_sweet
coool_sweet

Reputation: 19

TASK in Snowflake not running

I have a task on Snowflake which if I resume,it runs, but I don't see any history in the next day. I have scheduled it to run every min.

Do they have a timelimit?


Create statement :

create or replace task TEMP_DB.IAM.IAM_TASK
    warehouse= ELT_WHS
    schedule='1 minute'
    as call TEMP_DATA();

ALTER TASK TEMP_DB.IAM.IAM_TASK RESUME;

to see history I am using the following statement:

select *
from table(information_schema.task_history())
where
   database_name = 'TEMP_DB'
order by scheduled_time desc;

Upvotes: 1

Views: 308

Answers (1)

Lukasz Szozda
Lukasz Szozda

Reputation: 175606

The default result limit is 100, and it may reduce the number of rows returned. The database_name filter is applied afterwards.

I would try to extend the limit:

select *
from table(information_schema.task_history(RESULT_LIMIT => 10000))
where  database_name = 'TEMP_DB'
order by scheduled_time desc;

or try to search by task name:

select *
from table(information_schema.task_history(TASK_NAME => 'IAM_TASK'))
where  database_name = 'TEMP_DB'
order by scheduled_time desc;

Alternatively TASK_HISTORY view could be used:

Latency for the view may be up to 45 minutes.

SELECT * 
FROM snowflake.account_usage.task_history
WHERE DATABASE_NAME = 'TEMP_DB'
  AND SCHEMA_NAME = 'IAM'
  AND NAME = 'IAM_TASK'
ORDER BY SCHEDULED_TIME DESC;

Upvotes: 2

Related Questions