Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update query_history_enriched script to use Snowflake-provided query_attribution_history view #27

Merged
merged 6 commits into from
Oct 8, 2024

Conversation

obashaw
Copy link
Collaborator

@obashaw obashaw commented Oct 8, 2024

This PR updates the query_history_enriched.sql script used to power the Snowflake Cost per Query template.

The major change is that instead of using the cost per query calculation developed by select.dev, we now use Snowflake's query_attribution_history view which gives a credits-per-query breakdown.

I also moved some of the complex string and JSON parsing from the template into this script to optimize performance.

Copy link
Collaborator

@Fran-Britschgi Fran-Britschgi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great oscar. Much cleaner code

@obashaw obashaw merged commit e56f657 into main Oct 8, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants