This QuickStart provides instructions on how to set up Sigma's Snowflake Cost per Query template.
This template give you a prebuilt analysis of Snowflake costs by Sigma workbook / user and by Snowflake user, role and warehouse.
There are two steps to setting up the template:
query_history_enriched
table in your Snowflake accountAnyone who is trying to calculate the Snowflake cost-per-query or aggregate costs across different dimensions.
How to deploy Sigma's Snowflake Cost per Query template.
One way to create the query_history_enriched
table is by deploying the dbt-snowflake-monitoring dbt package from Select.
This package has a model called query_history_enriched
that enriches the Snowflake query_history
table with query cost information. It will calculate the actual cost (in currency) for every query run in your Snowflake account.
Once the package has been deployed, Sigma needs to be able to access the table(s) created.
grant select on table {database name}.{schema name}.query_history_enriched to role {role used in Sigma connection};
Note that you may need to grant usage on the database and schema that host this table.
Verify that you can see the new table(s) in the Sigma connection browser:
Next, advance to step 4.
Another way to create the query_history_enriched
table is by running the attached SQL script in your Snowflake account.
The script requires you to specify a few parameters:
Run the SQL script in your Snowflake account, and then verify that you can see the new table(s) in the Sigma connection browser.
Once you have created the query_history_enriched
table, go to Sigma.
From the home page, navigate to the Templates
section, then to External
.
Click on the Snowflake Cost per Query
template:
You will be prompted to swap data sources. Click Swap Now
:
Verify that Sigma has found the query_history_enriched
table and click Swap Now
:
Click Save As
and give your workbook a title.
That's all there is to it!
You should now see the Snowflake Cost per Query Template on top of your own data.
For example:
In this QuickStart we created the query_history_enriched
table and launched Sigma's Snowflake Cost per Query
template.
If you're interested in a Snowflake Optimization tool, check out Select!
Additional Resource Links
Be sure to check out all the latest developments at Sigma's First Friday Feature page!