Skip to content

Instantly share code, notes, and snippets.

@slopp
Created September 28, 2023 21:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save slopp/9ce7f9d38219cf6593ef9e9ae1f2dd7d to your computer and use it in GitHub Desktop.
Save slopp/9ce7f9d38219cf6593ef9e9ae1f2dd7d to your computer and use it in GitHub Desktop.
Credits Dagster OSS
with events as (select distinct
DATE_FORMAT(timestamp, '%Y-%m') as event_month,
dagster_event_type,
coalesce(run_id, '||', step_key) as step_id,
count(1) as credits
from event_logs
where dagster_event_type = 'STEP_START'
or dagster_event_type = 'ASSET_MATERIALIZATION'
group by 1, 2, 3
)
select
event_month,
sum(credits) as sum_credits
from events
group by 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment