DEA-C02 · Question #9
Which query will show a list of the 20 most recent executions of a specified task, MYTASK, that have been scheduled within the last hour that have ended or are still running? A. B. C. D.
The correct answer is B. select * from table(information_schema.task_history(scheduled_time_range_start =>dateadd('hour',-1,current_timestamp()), result_limit => 20, task_name=>'MYTASK')) where STATE IS NOT NULL. https://docs.snowflake.com/en/sql-reference/functions/task_history#examples To retrieve only tasks that are completed or still running, filter the query using WHERE query_id IS NOT NULL. Note that this filter is applied after RESULT_LIMIT already reduces the results returned…
Question
Which query will show a list of the 20 most recent executions of a specified task, MYTASK, that have been scheduled within the last hour that have ended or are still running? A. B. C. D.
Options
- Aselect * from table(information_schema.task_history(scheduled_time_range_start =>dateadd('hour',-1,current_timestamp()), result_limit => 20, task_name=>'MYTASK'))
- Bselect * from table(information_schema.task_history(scheduled_time_range_start =>dateadd('hour',-1,current_timestamp()), result_limit => 20, task_name=>'MYTASK')) where STATE IS NOT NULL
- Cselect * from table(information_schema.task_history(scheduled_time_range_start =>dateadd('hour',-1,current_timestamp()), result_limit => 20, task_name=>'MYTASK')) where STATE IN ('EXECUTING', 'SUCCEED', 'FAILED')
- Dselect * from table(information_schema.task_history(scheduled_time_range_start =>dateadd('hour',-1,current_timestamp()), result_limit => 20, task_name=>'MYTASK')) where STATE IN ('EXECUTING', 'SUCCEEDED')
How the community answered
(41 responses)- A7% (3)
- B76% (31)
- C15% (6)
- D2% (1)
Explanation
https://docs.snowflake.com/en/sql-reference/functions/task_history#examples To retrieve only tasks that are completed or still running, filter the query using WHERE query_id IS NOT NULL. Note that this filter is applied after RESULT_LIMIT already reduces the results returned, so the query could return 9 tasks if 1 task was scheduled but had not started yet.
Topics
Community Discussion
No community discussion yet for this question.