From a145a00b4debd2e96a96e02bd353f3c7371ae526 Mon Sep 17 00:00:00 2001 From: Joaquin Date: Tue, 18 Mar 2025 12:06:25 +0100 Subject: [PATCH] Adding id_deal --- .../int_edeposit__verification_fees.sql | 1 + .../edeposit/int_edeposit__verifications.sql | 85 ++++++++++--------- models/intermediate/edeposit/schema.yml | 12 +++ .../edeposit/edeposit__verification_fees.sql | 1 + models/reporting/edeposit/schema.yml | 6 ++ 5 files changed, 64 insertions(+), 41 deletions(-) diff --git a/models/intermediate/edeposit/int_edeposit__verification_fees.sql b/models/intermediate/edeposit/int_edeposit__verification_fees.sql index 8250d6a..94bbcfd 100644 --- a/models/intermediate/edeposit/int_edeposit__verification_fees.sql +++ b/models/intermediate/edeposit/int_edeposit__verification_fees.sql @@ -82,6 +82,7 @@ select v.id_verification, v.id_booking, v.id_user_partner, + v.id_deal, v.id_accommodation, v.listing_town, v.listing_country, diff --git a/models/intermediate/edeposit/int_edeposit__verifications.sql b/models/intermediate/edeposit/int_edeposit__verifications.sql index 6a27804..7447b8d 100644 --- a/models/intermediate/edeposit/int_edeposit__verifications.sql +++ b/models/intermediate/edeposit/int_edeposit__verifications.sql @@ -1,47 +1,50 @@ with stg_edeposit__verifications as ( select * from {{ ref("stg_edeposit__verifications") }} - ) + ), + stg_core__user as (select * from {{ ref("stg_core__user") }}) select -- note that these ids are not the same as the ones found in Core DWH -- they are completely unrelated - id_verification, - id_booking, - id_user_partner, - id_accommodation, - version, - case when version = 'V2' then 'Edeposit' else null end as verification_source, - verification_status, - nightly_fee_local, - cast(checkout_at_utc as date) - cast(checkin_at_utc as date) as number_nights, - email_flag, - phone_flag, - watch_list, - channel, - checkin_at_utc, - cast(checkin_at_utc as date) as checkin_date_utc, - checkout_at_utc, - cast(checkout_at_utc as date) as checkout_date_utc, - is_cancelled, - cancelled_at_utc, - cast(cancelled_at_utc as date) as cancelled_date_utc, - user_email, - guest_email, - guest_last_name, - guest_first_name, - guest_telephone, - company_name, - listing_name, - listing_address, - listing_town, - listing_country, - listing_postcode, - pets_allowed, - status_updated_at_utc, - status_updated_date_utc, - updated_at_utc, - athena_creation_at_utc, - athena_creation_date_utc, - created_at_utc, - created_date_utc -from stg_edeposit__verifications + v.id_verification, + v.id_booking, + v.id_user_partner, + u.id_deal, + v.id_accommodation, + v.version, + case when v.version = 'V2' then 'Edeposit' else null end as verification_source, + v.verification_status, + v.nightly_fee_local, + cast(v.checkout_at_utc as date) - cast(v.checkin_at_utc as date) as number_nights, + v.email_flag, + v.phone_flag, + v.watch_list, + v.channel, + v.checkin_at_utc, + cast(v.checkin_at_utc as date) as checkin_date_utc, + v.checkout_at_utc, + cast(v.checkout_at_utc as date) as checkout_date_utc, + v.is_cancelled, + v.cancelled_at_utc, + cast(v.cancelled_at_utc as date) as cancelled_date_utc, + v.user_email, + v.guest_email, + v.guest_last_name, + v.guest_first_name, + v.guest_telephone, + v.company_name, + v.listing_name, + v.listing_address, + v.listing_town, + v.listing_country, + v.listing_postcode, + v.pets_allowed, + v.status_updated_at_utc, + v.status_updated_date_utc, + v.updated_at_utc, + v.athena_creation_at_utc, + v.athena_creation_date_utc, + v.created_at_utc, + v.created_date_utc +from stg_edeposit__verifications v +inner join stg_core__user u on u.email = v.user_email diff --git a/models/intermediate/edeposit/schema.yml b/models/intermediate/edeposit/schema.yml index a19826c..925ed4b 100644 --- a/models/intermediate/edeposit/schema.yml +++ b/models/intermediate/edeposit/schema.yml @@ -31,6 +31,12 @@ models: data_tests: - not_null + - name: id_deal + data_type: text + description: "unique Superhog generated id for a deal" + data_tests: + - not_null + - name: id_accommodation data_type: text description: "unique Superhog generated id for a listing" @@ -224,6 +230,12 @@ models: data_tests: - not_null + - name: id_deal + data_type: text + description: "unique Superhog generated id for a deal" + data_tests: + - not_null + - name: id_accommodation data_type: text description: "unique Superhog generated id for a listing" diff --git a/models/reporting/edeposit/edeposit__verification_fees.sql b/models/reporting/edeposit/edeposit__verification_fees.sql index 130f0e7..7b2d0ff 100644 --- a/models/reporting/edeposit/edeposit__verification_fees.sql +++ b/models/reporting/edeposit/edeposit__verification_fees.sql @@ -7,6 +7,7 @@ select vf.id_verification as id_verification, vf.id_booking as id_booking, vf.id_user_partner as id_user_partner, + vf.id_deal as id_deal, vf.id_accommodation as id_accommodation, vf.listing_town as listing_town, vf.listing_country as listing_country, diff --git a/models/reporting/edeposit/schema.yml b/models/reporting/edeposit/schema.yml index 566d6b1..c7e7099 100644 --- a/models/reporting/edeposit/schema.yml +++ b/models/reporting/edeposit/schema.yml @@ -30,6 +30,12 @@ models: data_tests: - not_null + - name: id_deal + data_type: text + description: "unique Superhog generated id for a deal" + data_tests: + - not_null + - name: id_accommodation data_type: text description: "unique Superhog generated id for a listing"