Merged PR 3472: Remove unused models and schema entries for deals and accommodations
# Description Eliminates models that have been switched with new kpis flow. Also deletes temporary tests and schema entries. # Checklist - [X] The edited models and dependants run properly with production data. - [NA] The edited models are sufficiently documented. - [X] The edited models contain PK tests, and I've ran and passed them. - [X] I have checked for DRY opportunities with other models and docs. - [NA] I've picked the right materialization for the affected models. # Other - [ ] Check if a full-refresh is required after this PR is merged. Related work items: #23762
This commit is contained in:
parent
5e1b418570
commit
2f80642f6c
10 changed files with 1 additions and 1358 deletions
|
|
@ -1,120 +0,0 @@
|
|||
{% set min_date = "2022-01-01" %}
|
||||
{% set dimensions = ("global", "by_billing_country") %}
|
||||
-- "by_number_of_listings" excluded on purpose - there's differences because of daily
|
||||
-- segmentation
|
||||
with
|
||||
new_deals as (
|
||||
select
|
||||
date,
|
||||
dimension,
|
||||
dimension_value,
|
||||
new_deals,
|
||||
never_booked_deals,
|
||||
first_time_booked_deals,
|
||||
active_deals,
|
||||
churning_deals,
|
||||
inactive_deals,
|
||||
reactivated_deals,
|
||||
deals_booked_in_month,
|
||||
deals_booked_in_6_months,
|
||||
deals_booked_in_12_months
|
||||
from {{ ref("int_kpis__agg_daily_deals") }}
|
||||
where
|
||||
date >= '{{ min_date }}'
|
||||
and dimension in {{ dimensions }}
|
||||
and dimension_value <> 'UNSET'
|
||||
and (is_end_of_month = true or is_month_to_date = true)
|
||||
),
|
||||
old_deals as (
|
||||
select
|
||||
date,
|
||||
dimension,
|
||||
dimension_value,
|
||||
new_deals,
|
||||
never_booked_deals,
|
||||
first_time_booked_deals,
|
||||
active_deals,
|
||||
churning_deals,
|
||||
inactive_deals,
|
||||
reactivated_deals,
|
||||
deals_booked_in_month,
|
||||
deals_booked_in_6_months,
|
||||
deals_booked_in_12_months
|
||||
from {{ ref("int_mtd_deal_metrics") }}
|
||||
where date >= '{{ min_date }}' and dimension in {{ dimensions }}
|
||||
),
|
||||
comparison as (
|
||||
select
|
||||
coalesce(o.date, n.date) as date,
|
||||
coalesce(o.dimension, n.dimension) as dimension,
|
||||
coalesce(o.dimension_value, n.dimension_value) as dimension_value,
|
||||
o.new_deals as old_new_deals,
|
||||
n.new_deals as new_new_deals,
|
||||
coalesce(o.new_deals, 0) - coalesce(n.new_deals, 0) as diff_new_deals,
|
||||
|
||||
o.never_booked_deals as old_never_booked_deals,
|
||||
n.never_booked_deals as new_never_booked_deals,
|
||||
coalesce(o.never_booked_deals, 0)
|
||||
- coalesce(n.never_booked_deals, 0) as diff_never_booked_deals,
|
||||
|
||||
o.first_time_booked_deals as old_first_time_booked_deals,
|
||||
n.first_time_booked_deals as new_first_time_booked_deals,
|
||||
coalesce(o.first_time_booked_deals, 0)
|
||||
- coalesce(n.first_time_booked_deals, 0) as diff_first_time_booked_deals,
|
||||
|
||||
o.active_deals as old_active_deals,
|
||||
n.active_deals as new_active_deals,
|
||||
coalesce(o.active_deals, 0)
|
||||
- coalesce(n.active_deals, 0) as diff_active_deals,
|
||||
|
||||
o.inactive_deals as old_inactive_deals,
|
||||
n.inactive_deals as new_inactive_deals,
|
||||
coalesce(o.inactive_deals, 0)
|
||||
- coalesce(n.inactive_deals, 0) as diff_inactive_deals,
|
||||
|
||||
o.churning_deals as old_churning_deals,
|
||||
n.churning_deals as new_churning_deals,
|
||||
coalesce(o.churning_deals, 0)
|
||||
- coalesce(n.churning_deals, 0) as diff_churning_deals,
|
||||
|
||||
o.reactivated_deals as old_reactivated_deals,
|
||||
n.reactivated_deals as new_reactivated_deals,
|
||||
coalesce(o.reactivated_deals, 0)
|
||||
- coalesce(n.reactivated_deals, 0) as diff_reactivated_deals,
|
||||
|
||||
o.deals_booked_in_month as old_deals_booked_in_month,
|
||||
n.deals_booked_in_month as new_deals_booked_in_month,
|
||||
coalesce(o.deals_booked_in_month, 0)
|
||||
- coalesce(n.deals_booked_in_month, 0) as diff_deals_booked_in_month,
|
||||
|
||||
o.deals_booked_in_6_months as old_deals_booked_in_6_months,
|
||||
n.deals_booked_in_6_months as new_deals_booked_in_6_months,
|
||||
coalesce(o.deals_booked_in_6_months, 0)
|
||||
- coalesce(n.deals_booked_in_6_months, 0) as diff_deals_booked_in_6_months,
|
||||
|
||||
o.deals_booked_in_12_months as old_deals_booked_in_12_months,
|
||||
n.deals_booked_in_12_months as new_deals_booked_in_12_months,
|
||||
coalesce(o.deals_booked_in_12_months, 0)
|
||||
- coalesce(n.deals_booked_in_12_months, 0) as diff_deals_booked_in_12_months
|
||||
|
||||
from old_deals o
|
||||
full outer join
|
||||
new_deals n
|
||||
on o.date = n.date
|
||||
and o.dimension = n.dimension
|
||||
and o.dimension_value = n.dimension_value
|
||||
)
|
||||
select *
|
||||
from comparison
|
||||
where
|
||||
diff_new_deals <> 0
|
||||
or diff_never_booked_deals <> 0
|
||||
or diff_first_time_booked_deals <> 0
|
||||
or diff_active_deals <> 0
|
||||
or diff_inactive_deals <> 0
|
||||
or diff_churning_deals <> 0
|
||||
or diff_reactivated_deals <> 0
|
||||
or diff_deals_booked_in_month <> 0
|
||||
or diff_deals_booked_in_6_months <> 0
|
||||
or diff_deals_booked_in_12_months <> 0
|
||||
order by date desc
|
||||
|
|
@ -1,124 +0,0 @@
|
|||
{% set min_date = "2022-01-01" %}
|
||||
{% set dimensions = ("global", "by_billing_country") %}
|
||||
-- "by_number_of_listings" excluded on purpose - there's differences because of daily
|
||||
-- segmentation
|
||||
with
|
||||
new_listings as (
|
||||
select
|
||||
date,
|
||||
dimension,
|
||||
dimension_value,
|
||||
new_listings,
|
||||
never_booked_listings,
|
||||
first_time_booked_listings,
|
||||
active_listings,
|
||||
churning_listings,
|
||||
inactive_listings,
|
||||
reactivated_listings,
|
||||
listings_booked_in_month,
|
||||
listings_booked_in_6_months,
|
||||
listings_booked_in_12_months
|
||||
from {{ ref("int_kpis__agg_daily_listings") }}
|
||||
where
|
||||
date >= '{{ min_date }}'
|
||||
and dimension in {{ dimensions }}
|
||||
and dimension_value <> 'UNSET'
|
||||
and (is_end_of_month = true or is_month_to_date = true)
|
||||
),
|
||||
old_listings as (
|
||||
select
|
||||
date,
|
||||
dimension,
|
||||
dimension_value,
|
||||
new_listings,
|
||||
never_booked_listings,
|
||||
first_time_booked_listings,
|
||||
active_listings,
|
||||
churning_listings,
|
||||
inactive_listings,
|
||||
reactivated_listings,
|
||||
listings_booked_in_month,
|
||||
listings_booked_in_6_months,
|
||||
listings_booked_in_12_months
|
||||
from {{ ref("int_core__mtd_accommodation_metrics") }}
|
||||
where date >= '{{ min_date }}' and dimension in {{ dimensions }}
|
||||
),
|
||||
comparison as (
|
||||
select
|
||||
coalesce(o.date, n.date) as date,
|
||||
coalesce(o.dimension, n.dimension) as dimension,
|
||||
coalesce(o.dimension_value, n.dimension_value) as dimension_value,
|
||||
o.new_listings as old_new_listings,
|
||||
n.new_listings as new_new_listings,
|
||||
coalesce(o.new_listings, 0)
|
||||
- coalesce(n.new_listings, 0) as diff_new_listings,
|
||||
|
||||
o.never_booked_listings as old_never_booked_listings,
|
||||
n.never_booked_listings as new_never_booked_listings,
|
||||
coalesce(o.never_booked_listings, 0)
|
||||
- coalesce(n.never_booked_listings, 0) as diff_never_booked_listings,
|
||||
|
||||
o.first_time_booked_listings as old_first_time_booked_listings,
|
||||
n.first_time_booked_listings as new_first_time_booked_listings,
|
||||
coalesce(o.first_time_booked_listings, 0) - coalesce(
|
||||
n.first_time_booked_listings, 0
|
||||
) as diff_first_time_booked_listings,
|
||||
|
||||
o.active_listings as old_active_listings,
|
||||
n.active_listings as new_active_listings,
|
||||
coalesce(o.active_listings, 0)
|
||||
- coalesce(n.active_listings, 0) as diff_active_listings,
|
||||
|
||||
o.inactive_listings as old_inactive_listings,
|
||||
n.inactive_listings as new_inactive_listings,
|
||||
coalesce(o.inactive_listings, 0)
|
||||
- coalesce(n.inactive_listings, 0) as diff_inactive_listings,
|
||||
|
||||
o.churning_listings as old_churning_listings,
|
||||
n.churning_listings as new_churning_listings,
|
||||
coalesce(o.churning_listings, 0)
|
||||
- coalesce(n.churning_listings, 0) as diff_churning_listings,
|
||||
|
||||
o.reactivated_listings as old_reactivated_listings,
|
||||
n.reactivated_listings as new_reactivated_listings,
|
||||
coalesce(o.reactivated_listings, 0)
|
||||
- coalesce(n.reactivated_listings, 0) as diff_reactivated_listings,
|
||||
|
||||
o.listings_booked_in_month as old_listings_booked_in_month,
|
||||
n.listings_booked_in_month as new_listings_booked_in_month,
|
||||
coalesce(o.listings_booked_in_month, 0)
|
||||
- coalesce(n.listings_booked_in_month, 0) as diff_listings_booked_in_month,
|
||||
|
||||
o.listings_booked_in_6_months as old_listings_booked_in_6_months,
|
||||
n.listings_booked_in_6_months as new_listings_booked_in_6_months,
|
||||
coalesce(o.listings_booked_in_6_months, 0) - coalesce(
|
||||
n.listings_booked_in_6_months, 0
|
||||
) as diff_listings_booked_in_6_months,
|
||||
|
||||
o.listings_booked_in_12_months as old_listings_booked_in_12_months,
|
||||
n.listings_booked_in_12_months as new_listings_booked_in_12_months,
|
||||
coalesce(o.listings_booked_in_12_months, 0) - coalesce(
|
||||
n.listings_booked_in_12_months, 0
|
||||
) as diff_listings_booked_in_12_months
|
||||
|
||||
from old_listings o
|
||||
full outer join
|
||||
new_listings n
|
||||
on o.date = n.date
|
||||
and o.dimension = n.dimension
|
||||
and o.dimension_value = n.dimension_value
|
||||
)
|
||||
select *
|
||||
from comparison
|
||||
where
|
||||
diff_new_listings <> 0
|
||||
or diff_never_booked_listings <> 0
|
||||
or diff_first_time_booked_listings <> 0
|
||||
or diff_active_listings <> 0
|
||||
or diff_inactive_listings <> 0
|
||||
or diff_churning_listings <> 0
|
||||
or diff_reactivated_listings <> 0
|
||||
or diff_listings_booked_in_month <> 0
|
||||
or diff_listings_booked_in_6_months <> 0
|
||||
or diff_listings_booked_in_12_months <> 0
|
||||
order by date desc
|
||||
Loading…
Add table
Add a link
Reference in a new issue