From 986c9f85a8a5cb9d5499934525785c039e531022 Mon Sep 17 00:00:00 2001 From: Joaquin Date: Thu, 19 Jun 2025 09:04:48 +0200 Subject: [PATCH 1/3] exclude deals without lifecycle --- models/intermediate/core/int_core__new_dash_user_overview.sql | 2 +- models/intermediate/resolutions/schema.yml | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/models/intermediate/core/int_core__new_dash_user_overview.sql b/models/intermediate/core/int_core__new_dash_user_overview.sql index 40a4b61..e23dd20 100644 --- a/models/intermediate/core/int_core__new_dash_user_overview.sql +++ b/models/intermediate/core/int_core__new_dash_user_overview.sql @@ -134,7 +134,7 @@ with left join atpb_aggregation atpb on upb.id_user_host = atpb.id_user_host left join btpb_aggregation btpb on upb.id_user_host = btpb.id_user_host inner join int_core__user_host uh on upb.id_user_host = uh.id_user_host - left join int_kpis__lifecycle_daily_deal kldd on uh.id_deal = kldd.id_deal + inner join int_kpis__lifecycle_daily_deal kldd on uh.id_deal = kldd.id_deal ), user_with_boolean_features as ( select diff --git a/models/intermediate/resolutions/schema.yml b/models/intermediate/resolutions/schema.yml index 601b292..75cfb97 100644 --- a/models/intermediate/resolutions/schema.yml +++ b/models/intermediate/resolutions/schema.yml @@ -279,7 +279,8 @@ models: description: | "Unique Id that identifies the host." data_tests: - - not_null + - not_null: + where: "original_value_amount_in_host_currency > 0" - relationships: to: ref('stg_core__user') field: id_user From ecf38144cbf4ebd5201fef7edb7e376747c29f98 Mon Sep 17 00:00:00 2001 From: Joaquin Date: Thu, 19 Jun 2025 09:09:56 +0200 Subject: [PATCH 2/3] fixed schema --- models/intermediate/resolutions/schema.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/models/intermediate/resolutions/schema.yml b/models/intermediate/resolutions/schema.yml index 75cfb97..601b292 100644 --- a/models/intermediate/resolutions/schema.yml +++ b/models/intermediate/resolutions/schema.yml @@ -279,8 +279,7 @@ models: description: | "Unique Id that identifies the host." data_tests: - - not_null: - where: "original_value_amount_in_host_currency > 0" + - not_null - relationships: to: ref('stg_core__user') field: id_user From 147197c92dbb6c099840ab46d673078c810a475a Mon Sep 17 00:00:00 2001 From: Joaquin Date: Thu, 19 Jun 2025 11:35:52 +0200 Subject: [PATCH 3/3] Modified test --- .../intermediate/core/int_core__new_dash_user_overview.sql | 2 +- models/intermediate/core/schema.yml | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/models/intermediate/core/int_core__new_dash_user_overview.sql b/models/intermediate/core/int_core__new_dash_user_overview.sql index e23dd20..40a4b61 100644 --- a/models/intermediate/core/int_core__new_dash_user_overview.sql +++ b/models/intermediate/core/int_core__new_dash_user_overview.sql @@ -134,7 +134,7 @@ with left join atpb_aggregation atpb on upb.id_user_host = atpb.id_user_host left join btpb_aggregation btpb on upb.id_user_host = btpb.id_user_host inner join int_core__user_host uh on upb.id_user_host = uh.id_user_host - inner join int_kpis__lifecycle_daily_deal kldd on uh.id_deal = kldd.id_deal + left join int_kpis__lifecycle_daily_deal kldd on uh.id_deal = kldd.id_deal ), user_with_boolean_features as ( select diff --git a/models/intermediate/core/schema.yml b/models/intermediate/core/schema.yml index f23da30..9bce5bf 100644 --- a/models/intermediate/core/schema.yml +++ b/models/intermediate/core/schema.yml @@ -2344,7 +2344,11 @@ models: 01-New, 02-Never Booked, 04-Active, 05-Churning, 06-Inactive, 07-Reactivated, 99-Not in Husbpot. data_tests: - - not_null + - not_null: + # Exclude the users that have been migrated + # in the last 24 hours, since they might not yet be in + # HubSpot and thus the lifecycle state is not yet set. + where: "user_estimated_migration_date_utc <> current_date - INTERVAL '1 day'" - accepted_values: values: - 01-New