Skip to content

Commit

Permalink
Merge pull request #30 from flexanalytics/most-recent-partition
Browse files Browse the repository at this point in the history
partition by project_id when calculating most_recent_run
  • Loading branch information
MiConnell authored Oct 18, 2024
2 parents ced578e + dad946b commit 7dc3168
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion models/marts/dim_execution.sql
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ with
thread_id,
compile_started_at,
query_completed_at,
rank() over (order by run_started_at desc) as run_rank,
rank() over (partition by project order by run_started_at desc) as run_rank,
rank() over (partition by node_id order by run_started_at desc) as node_rank,
rank() over (partition by node_id, cast(run_started_at as date) order by run_started_at desc) as node_rank_per_day
from {{ ref('dbt_observability_marts', 'int_execution') }}
Expand Down
4 changes: 2 additions & 2 deletions models/marts/dim_invocation.sql
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ with
env_vars,
dbt_vars,
run_started_at,
rank() over (order by run_started_at desc) as invocation_rank,
rank() over (partition by project_name order by run_started_at desc) as invocation_rank,
rank() over (
partition by cast(run_started_at as date)
partition by project_name, cast(run_started_at as date)
order by run_started_at desc
) as invocation_rank_per_day
from {{ ref('dbt_observability_marts', 'stg_invocation') }}
Expand Down
2 changes: 1 addition & 1 deletion models/marts/dim_invocation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ models:
meta:
label: Invocation Order
- name: most_recent_run
description: '"Yes" if this is the most recent invocation for all time, otherwise "No"'
description: '"Yes" if this is the most recent invocation for all time, partitioned by project, otherwise "No"'
meta:
label: Most Recent Run
- name: invocation_rank_per_day
Expand Down

0 comments on commit 7dc3168

Please sign in to comment.