From 5bcfd7cb9c6b16537813da42416c47e2f1aa3d7e Mon Sep 17 00:00:00 2001 From: Joaquin Date: Tue, 5 Nov 2024 12:37:31 +0100 Subject: [PATCH] Revert cross models --- .../cross/int_monthly_12m_window_contribution_by_deal.sql | 6 +++--- ...=> int_monthly_aggregated_metrics_history_by_deal.sql} | 0 .../cross/int_monthly_growth_score_by_deal.sql | 6 +++--- ...mtd_agg_metrics.sql => int_mtd_aggregated_metrics.sql} | 0 models/reporting/exposures.yml | 4 ++-- ...sql => monthly_aggregated_metrics_history_by_deal.sql} | 6 +++--- .../{mtd_agg_metrics.sql => mtd_aggregated_metrics.sql} | 6 +++--- models/reporting/general/schema.yml | 8 ++++---- 8 files changed, 18 insertions(+), 18 deletions(-) rename models/intermediate/cross/{int_monthly_agg_metrics_history_by_deal.sql => int_monthly_aggregated_metrics_history_by_deal.sql} (100%) rename models/intermediate/cross/{int_mtd_agg_metrics.sql => int_mtd_aggregated_metrics.sql} (100%) rename models/reporting/general/{monthly_agg_metrics_history_by_deal.sql => monthly_aggregated_metrics_history_by_deal.sql} (95%) rename models/reporting/general/{mtd_agg_metrics.sql => mtd_aggregated_metrics.sql} (96%) diff --git a/models/intermediate/cross/int_monthly_12m_window_contribution_by_deal.sql b/models/intermediate/cross/int_monthly_12m_window_contribution_by_deal.sql index 7bdbb48..bce0b21 100644 --- a/models/intermediate/cross/int_monthly_12m_window_contribution_by_deal.sql +++ b/models/intermediate/cross/int_monthly_12m_window_contribution_by_deal.sql @@ -1,7 +1,7 @@ {{ config(materialized="table", unique_key=["date", "id_deal"]) }} with - int_monthly_agg_metrics_history_by_deal as ( - select * from {{ ref("int_monthly_agg_metrics_history_by_deal") }} + int_monthly_aggregated_metrics_history_by_deal as ( + select * from {{ ref("int_monthly_aggregated_metrics_history_by_deal") }} ), agg_metrics_by_deal_over_12_months as ( select @@ -28,7 +28,7 @@ with order by am.date rows between 12 preceding and 1 preceding ) as sum_listings_booked_in_month_preceding_12_months - from int_monthly_agg_metrics_history_by_deal am + from int_monthly_aggregated_metrics_history_by_deal am ), global_computation_over_12_months as ( select diff --git a/models/intermediate/cross/int_monthly_agg_metrics_history_by_deal.sql b/models/intermediate/cross/int_monthly_aggregated_metrics_history_by_deal.sql similarity index 100% rename from models/intermediate/cross/int_monthly_agg_metrics_history_by_deal.sql rename to models/intermediate/cross/int_monthly_aggregated_metrics_history_by_deal.sql diff --git a/models/intermediate/cross/int_monthly_growth_score_by_deal.sql b/models/intermediate/cross/int_monthly_growth_score_by_deal.sql index bba2d4f..9941236 100644 --- a/models/intermediate/cross/int_monthly_growth_score_by_deal.sql +++ b/models/intermediate/cross/int_monthly_growth_score_by_deal.sql @@ -1,7 +1,7 @@ {{ config(materialized="table", unique_key=["date", "id_deal"]) }} with - int_monthly_agg_metrics_history_by_deal as ( - select * from {{ ref("int_monthly_agg_metrics_history_by_deal") }} + int_monthly_aggregated_metrics_history_by_deal as ( + select * from {{ ref("int_monthly_aggregated_metrics_history_by_deal") }} ), int_hubspot__deal as (select * from {{ ref("int_hubspot__deal") }}), deal_history_from_previous_months as ( @@ -17,7 +17,7 @@ with coalesce(total_revenue_in_gbp, 0) as revenue_in_gbp, coalesce(created_bookings, 0) as created_bookings, coalesce(listings_booked_in_month, 0) as listings_booked_in_month - from int_monthly_agg_metrics_history_by_deal am + from int_monthly_aggregated_metrics_history_by_deal am -- Do not show data of ongoing month where am.date < date_trunc('month', current_date)::date ), diff --git a/models/intermediate/cross/int_mtd_agg_metrics.sql b/models/intermediate/cross/int_mtd_aggregated_metrics.sql similarity index 100% rename from models/intermediate/cross/int_mtd_agg_metrics.sql rename to models/intermediate/cross/int_mtd_aggregated_metrics.sql diff --git a/models/reporting/exposures.yml b/models/reporting/exposures.yml index 26970e7..6bf660c 100644 --- a/models/reporting/exposures.yml +++ b/models/reporting/exposures.yml @@ -113,8 +113,8 @@ exposures: Additionally, it allows to retrieve similar KPIs at Deal level. depends_on: - - ref('mtd_agg_metrics') - - ref('monthly_agg_metrics_history_by_deal') + - ref('mtd_aggregated_metrics') + - ref('monthly_aggregated_metrics_history_by_deal') owner: name: Oriol Roqué diff --git a/models/reporting/general/monthly_agg_metrics_history_by_deal.sql b/models/reporting/general/monthly_aggregated_metrics_history_by_deal.sql similarity index 95% rename from models/reporting/general/monthly_agg_metrics_history_by_deal.sql rename to models/reporting/general/monthly_aggregated_metrics_history_by_deal.sql index 6922fc2..0a5bb22 100644 --- a/models/reporting/general/monthly_agg_metrics_history_by_deal.sql +++ b/models/reporting/general/monthly_aggregated_metrics_history_by_deal.sql @@ -1,6 +1,6 @@ with - int_monthly_agg_metrics_history_by_deal as ( - select * from {{ ref("int_monthly_agg_metrics_history_by_deal") }} + int_monthly_aggregated_metrics_history_by_deal as ( + select * from {{ ref("int_monthly_aggregated_metrics_history_by_deal") }} ) select @@ -113,4 +113,4 @@ select deposit_fees_in_gbp as deposit_fees_in_gbp, waiver_payments_in_gbp as waiver_payments_in_gbp, checkin_cover_fees_in_gbp as checkin_cover_fees_in_gbp -from int_monthly_agg_metrics_history_by_deal +from int_monthly_aggregated_metrics_history_by_deal diff --git a/models/reporting/general/mtd_agg_metrics.sql b/models/reporting/general/mtd_aggregated_metrics.sql similarity index 96% rename from models/reporting/general/mtd_agg_metrics.sql rename to models/reporting/general/mtd_aggregated_metrics.sql index f3f9326..d9c1aad 100644 --- a/models/reporting/general/mtd_agg_metrics.sql +++ b/models/reporting/general/mtd_aggregated_metrics.sql @@ -11,9 +11,9 @@ with {% endif %} {% endfor %} ), - int_mtd_agg_metrics as ( + int_mtd_aggregated_metrics as ( select m.*, d.dimension_display - from {{ ref("int_mtd_agg_metrics") }} m + from {{ ref("int_mtd_aggregated_metrics") }} m -- The following clause limits the display execution -- to only include those dimensions configured to -- appear for production purposes @@ -38,7 +38,7 @@ select previous_year_value as previous_year_value, relative_increment as relative_increment, relative_increment_with_sign_format as relative_increment_with_sign_format -from int_mtd_agg_metrics +from int_mtd_aggregated_metrics /* The following where condition is applied to avoid displaying revenue metrics in the MTD for the current month and the previous month. The main reason is diff --git a/models/reporting/general/schema.yml b/models/reporting/general/schema.yml index 525429d..21a6518 100644 --- a/models/reporting/general/schema.yml +++ b/models/reporting/general/schema.yml @@ -307,7 +307,7 @@ models: tests: - not_null - - name: mtd_agg_metrics + - name: mtd_aggregated_metrics description: | This model aggregates the historic information of our business by providing different metrics computed at global and dimension level. @@ -447,19 +447,19 @@ models: positive impact for Superhog, otherwise is equal to relative_increment. This value is specially created for formatting in PBI - - name: monthly_agg_metrics_history_by_deal + - name: monthly_aggregated_metrics_history_by_deal description: | This model aggregates the monthly historic information regarding the different metrics computed at deal level. The primary source of data is the `int_monthly_XXXXX_history_by_deal` model which contain the raw metrics data per source. This table is used to provide "By Deal" metrics in the Business Overview reporting. - Unlike the mtd_agg_metrics, this model does not abstract each metric, since + Unlike the mtd_aggregated_metrics, this model does not abstract each metric, since no comparison versus last year is performed. In short, it just gathers the information stored in the abovementioned models. To keep in mind: aggregating the information of this model will not necessarily result into - the int_mtd_agg_metrics because 1) the mtd version contains more computing dates + the int_mtd_aggregated_metrics because 1) the mtd version contains more computing dates than the by deal version, the latest being a subset of the first, and 2) the deal based model enforces that a booking/guest journey/listing/etc has a host with a deal assigned, which is not necessarily the case.