How to get output of Snowflake SQL (not javascript) stored procedure called from task

Viewed 40

I am calling a Snowflake SQL (language SQL) stored procedure from a Snowflake task. This is not a JAVASCRIPT stored procedure. The stored procedure returns a value with some logging information that I would like to be able to see rather than only seeing the job was successful. How can I see that output from the stored procedure when I look at the history of the Snowflake task?

1 Answers

Putting an example here, for reference -

Check task status -

select query_id,name,state from table(information_schema.task_history());
QUERY_ID NAME STATE
NULL T1 SCHEDULED

Once task is executed query_id will get populated -

Use that query id to fetch result -

select query_id,name,state,query_text from table(information_schema.task_history());
QUERY_ID NAME STATE QUERY_TEXT
NULL T1 SCHEDULED call dummy_proc()
01a4af4f-3200-609f-0000-0000a9451151 T1 SUCCEEDED call dummy_proc()
select * from table(result_scan('01a4af4f-3200-609f-0000-0000a9451151'));
DUMMY_PROC
some text
Related