Scheduled Query Execution Report
Scheduled Query Execution Report
A notebook to report on failed or long-running scheduled queries, providing insights into reliability issues.
Here's a breakdown of the steps:
- Retrieve Data
- Convert Table to a DataFrame
- Create an Interactive Slider Widget & Data Preparation
- Create a Heatmap for Visualizing Scheduled Query Execution
1. Retrieve Data
Firstly, we'll write an SQL query to retrieve the execution history for scheduled queries, along with their status, timing metrics, and execution status.
We're obtaining this from the snowflake.account_usage.task_history table.
2. Convert Table to a DataFrame
Next, we'll convert the table to a Pandas DataFrame.
3. Create an Interactive Slider Widget & Data Preparation
Here, we'll create an interactive slider for dynamically selecting the number of days to analyze. This would then trigger the filtering of the DataFrame to the specified number of days.
Next, we'll reshape the data by calculating the frequency count by hour and task name, which will subsequently be used for creating the heatmap in the next step.
4. Create a Heatmap for Visualizing Scheduled Query Execution
Finally, a heatmap and summary statistics table are generated that will allow us to gain insights on the task name and state (e.g. SUCCEEDED, FAILED, SKIPPED).
Want to learn more?
- Snowflake Docs on Account Usage and TASK_HISTORY view
- More about Snowflake Notebooks
- For more inspiration on how to use Streamlit widgets in Notebooks, check out Streamlit Docs and this list of what is currently supported inside Snowflake Notebooks
- Check out the Altair User Guide for further information on customizing Altair charts