Skip to content

Commit

Permalink
Switch to table
Browse files Browse the repository at this point in the history
  • Loading branch information
NiallRees committed Jan 15, 2024
1 parent b69f913 commit 6e4ca0b
Showing 1 changed file with 1 addition and 8 deletions.
9 changes: 1 addition & 8 deletions models/staging/stg_metering_history.sql
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{{ config(
materialized='incremental',
unique_key=['service_type', 'start_time', 'entity_id'],
materialized='table'
) }}

select
Expand All @@ -13,10 +12,4 @@ select
credits_used_cloud_services,
credits_used
from {{ source('snowflake_account_usage', 'metering_history') }}

{% if is_incremental() %}
-- account for changing metering data
where end_time > (select coalesce(dateadd(day, -7, max(end_time)), '1970-01-01') from {{ this }})
{% endif %}

order by start_time asc

0 comments on commit 6e4ca0b

Please sign in to comment.