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

Add snowpipe streaming to hourly spend #125

Merged
merged 2 commits into from
Aug 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .changes/4.5.0.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
## dbt-snowflake-monitoring 4.5.0 - August 09, 2023

### Features

- Add Snowpipe Streaming ([#125](https://github.com/get-select/dbt-snowflake-monitoring/pull/125))


8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,14 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html),
and is generated by [Changie](https://github.com/miniscruff/changie).

## dbt-snowflake-monitoring 4.5.0 - August 09, 2023

### Features

- Add Snowpipe Streaming ([#125](https://github.com/get-select/dbt-snowflake-monitoring/pull/125))



## dbt-snowflake-monitoring 4.4.1 - July 28, 2023

### Features
Expand Down
2 changes: 1 addition & 1 deletion dbt_project.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: 'dbt_snowflake_monitoring'
version: '4.4.1'
version: '4.5.0'
config-version: 2

profile: dbt_snowflake_monitoring
Expand Down
1 change: 1 addition & 0 deletions integration_test_project/seeds/monthly_spend_fixture.csv
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ MONTH,SERVICE,SPEND
2022-04-01,Cloud Services,74.921528302
2022-04-01,Automatic Clustering,0.051113362
2022-04-01,Snowpipe,0
2022-04-01,Snowpipe Streaming,0
2022-04-01,Serverless Tasks,0
2022-04-01,Search Optimization,0
2022-04-01,Replication,0
Expand Down
30 changes: 30 additions & 0 deletions models/hourly_spend.sql
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,34 @@ snowpipe_spend_hourly as (
group by 1, 2, 3, 4
),

snowpipe_streaming_spend_hourly as (
select
hours.hour,
'Snowpipe Streaming' as service,
null as storage_type,
null as warehouse_name,
null as database_name,
coalesce(
sum(
stg_metering_history.credits_used * daily_rates.effective_rate
),
0
) as spend,
spend as spend_net_cloud_services,
any_value(daily_rates.currency) as currency
from hours
left join {{ ref('stg_metering_history') }} on
hours.hour = convert_timezone(
'UTC', stg_metering_history.start_time
)
and stg_metering_history.service_type = 'SNOWPIPE_STREAMING'
left join {{ ref('daily_rates') }}
on hours.hour::date = daily_rates.date
and daily_rates.service_type = 'COMPUTE'
and daily_rates.usage_type = 'snowpipe streaming'
group by 1, 2, 3, 4
),

query_acceleration_spend_hourly as (
select
hours.hour,
Expand Down Expand Up @@ -433,6 +461,8 @@ unioned as (
union all
select * from snowpipe_spend_hourly
union all
select * from snowpipe_streaming_spend_hourly
union all
select * from query_acceleration_spend_hourly
union all
select * from replication_spend_hourly
Expand Down