Revert query_history_enriched script to original cost-per-query logic #35
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR updates the cost-per-query calculation to use Select.dev's logic, rather than Snowflake's query_attribution_history view. It preserves the table structure of the most recent query_history_enriched script so that all previously-existing columns are present.
On Dec 11, a user noted that Snowflake's query_attribution_history was vastly undercounting the compute credits used when aggregated across warehouses and days. We were able to confirm this internally, and understand the source of the error to be the fact that query_attribution_history does not account for warehouse idle time (see Snowflake docs).
The calculations used in this version of the script tie out within a few percent of Snowflake's usage_in_currency_daily view.