From 0a812c8c0036aac26977682e42362856f6d695d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javier=20R=C3=ADos?= Date: Tue, 26 Nov 2024 21:39:52 +0100 Subject: [PATCH] fix: filter intermediate dependency events by `artifacts_v1` (#2526) * fix: filter intermediate dependency events by `artifacts_v1` * fix: remove `cyclic` dependency --- .../events/int_events__dependencies.sql | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/warehouse/dbt/models/intermediate/events/int_events__dependencies.sql b/warehouse/dbt/models/intermediate/events/int_events__dependencies.sql index 124121ad6..d8a78dd55 100644 --- a/warehouse/dbt/models/intermediate/events/int_events__dependencies.sql +++ b/warehouse/dbt/models/intermediate/events/int_events__dependencies.sql @@ -17,15 +17,21 @@ with snapshots as ( where `MinimumDepth` = 1 ), +artifacts as ( + select artifact_name + from {{ ref('int_all_artifacts') }} + where artifact_source = "NPM" +), + intermediate as ( select `time`, case - when previous_to_artifact_name is null then 'ADD_DEPENDENCY' + when previous_to_artifact_name is null then "ADD_DEPENDENCY" when to_artifact_name is not null and to_artifact_name <> previous_to_artifact_name - then 'REMOVE_DEPENDENCY' - else 'NO_CHANGE' + then "REMOVE_DEPENDENCY" + else "NO_CHANGE" end as event_type, {{ event_source_name }} as event_source, {{ parse_name( @@ -48,6 +54,7 @@ intermediate as ( from_artifact_type, 1.0 as amount from snapshots + where from_artifact_name in (select artifact_name from artifacts) ), artifact_ids as ( @@ -81,7 +88,7 @@ artifact_ids as ( }} as from_artifact_source_id, amount from intermediate - where event_type <> 'NO_CHANGE' + where event_type <> "NO_CHANGE" ), changes as (