From db493db8d9126313c8c500c14cc8342669105c65 Mon Sep 17 00:00:00 2001 From: Pablo Martin Date: Mon, 18 Mar 2024 12:05:55 +0100 Subject: [PATCH 1/5] add new tables to sources --- models/staging/core/_core_sources.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/models/staging/core/_core_sources.yml b/models/staging/core/_core_sources.yml index b61b8ca..6ad1f40 100644 --- a/models/staging/core/_core_sources.yml +++ b/models/staging/core/_core_sources.yml @@ -169,6 +169,8 @@ sources: description: "{{ doc('_airbyte_meta_desc') }}" - name: superhog_user identifier: SuperhogUser + - name: Verification + identifier: Verification - name: VerificationToPayment identifier: VerificationToPayment - name: VerificationPaymentType @@ -177,3 +179,10 @@ sources: identifier: Payment - name: PaymentStatus identifier: PaymentStatus + - name: Booking + identifier: Booking + - name: PricePlanToUser + identifier: PricePlanToUser + - name: PricePlanChargedByType + identifier: PricePlanChargedByType + From 1a5db1a8c4fc7614dd2fe338d88ef76bd3767deb Mon Sep 17 00:00:00 2001 From: Pablo Martin Date: Mon, 18 Mar 2024 12:20:27 +0100 Subject: [PATCH 2/5] add verification request to sources --- models/staging/core/_core_sources.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/models/staging/core/_core_sources.yml b/models/staging/core/_core_sources.yml index 6ad1f40..e97e52e 100644 --- a/models/staging/core/_core_sources.yml +++ b/models/staging/core/_core_sources.yml @@ -171,6 +171,8 @@ sources: identifier: SuperhogUser - name: Verification identifier: Verification + - name: VerificationRequest + identifier: VerificationRequest - name: VerificationToPayment identifier: VerificationToPayment - name: VerificationPaymentType From 71cae21ceabd40799a00be7e968645e5f9e025ae Mon Sep 17 00:00:00 2001 From: Pablo Martin Date: Mon, 18 Mar 2024 12:37:36 +0100 Subject: [PATCH 3/5] staging model for booking --- models/staging/core/stg_core__booking.sql | 35 +++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 models/staging/core/stg_core__booking.sql diff --git a/models/staging/core/stg_core__booking.sql b/models/staging/core/stg_core__booking.sql new file mode 100644 index 0000000..68e3c8e --- /dev/null +++ b/models/staging/core/stg_core__booking.sql @@ -0,0 +1,35 @@ +with + raw_booking as (select * from {{ source("core", "Booking") }}), + stg_core__booking as ( + select + {{ adapter.quote("BookingId") }} as id_booking, + {{ adapter.quote("GuestUserId") }} as id_user_guest, + {{ adapter.quote("CreatedByUserId") }} as id_user_host, + {{ adapter.quote("IntegrationId") }} as id_integration, + {{ adapter.quote("AccommodationId") }} as id_accommodation, + {{ adapter.quote("BookingSourceId") }} as id_booking_source, + {{ adapter.quote("VerificationRequestId") }} as id_verification_request, + {{ adapter.quote("BookingStateId") }} as id_booking_state, + {{ adapter.quote("StagingHostBookingId") }} as id_staging_host_booking, + {{ adapter.quote("CheckIn") }} as check_in_at_utc, + cast({{ adapter.quote("CheckIn") }} as date) as check_in_date_utc, + {{ adapter.quote("CheckOut") }} as check_out_at_utc, + cast({{ adapter.quote("CheckOut") }} as date) as check_out_date_utc, + {{ adapter.quote("Summary") }} as summary, + {{ adapter.quote("GuestEmail") }} as guest_email, + {{ adapter.quote("GuestLastName") }} as guest_last_name, + {{ adapter.quote("GuestFirstName") }} as guest_first_name, + {{ adapter.quote("GuestTelephone") }} as guest_telephone, + {{ adapter.quote("AdditionalGuests") }} as additional_guests, + {{ adapter.quote("UnsubscribeVerificationReminder") }} + as unsubscribe_verification_reminder, + {{ adapter.quote("CreatedDate") }} as created_at_utc, + cast({{ adapter.quote("CreatedDate") }} as date) as created_date_utc, + {{ adapter.quote("UpdatedDate") }} as updated_at_utc, + cast({{ adapter.quote("UpdatedDate") }} as date) as updated_date_utc, + {{ adapter.quote("_airbyte_extracted_at") }} as dwh_extracted_at_utc + + from raw_booking + ) +select * +from stg_core__booking From 1ea4b49c314c7396580043c6f16d605794d6b05e Mon Sep 17 00:00:00 2001 From: Pablo Martin Date: Mon, 18 Mar 2024 13:01:26 +0100 Subject: [PATCH 4/5] add verification request staging model --- .../core/stg_core__verification_request.sql | 46 +++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 models/staging/core/stg_core__verification_request.sql diff --git a/models/staging/core/stg_core__verification_request.sql b/models/staging/core/stg_core__verification_request.sql new file mode 100644 index 0000000..c1d2967 --- /dev/null +++ b/models/staging/core/stg_core__verification_request.sql @@ -0,0 +1,46 @@ +with + raw_verification_request as ( + select * from {{ source("core", "VerificationRequest") }} + ), + stg_core__verification_request as ( + select + {{ adapter.quote("Id") }} as id_verification_request, + lower({{ adapter.quote("Identifier") }}) as uuid_verification_request, + {{ adapter.quote("VerificationSetId") }} as id_verification_set, + {{ adapter.quote("SuperhogVerifiedSetId") }} as id_superhog_verified_set, + {{ adapter.quote("PaymentValidationSetId") }} as id_payment_validation_set, + {{ adapter.quote("SuperhogUserId") }} as id_user_guest, + {{ adapter.quote("CreatedByUserId") }} as id_user_host, + {{ adapter.quote("Url") }} as verification_url, + {{ adapter.quote("CallbackUrl") }} as callback_url, + {{ adapter.quote("RedirectUrl") }} as redirect_url, + {{ adapter.quote("Logo") }} as logo, + {{ adapter.quote("Email") }} as guest_email, + {{ adapter.quote("LastName") }} as last_name, + {{ adapter.quote("FirstName") }} as first_name, + {{ adapter.quote("PhoneNumber") }} as guest_phone_number, + {{ adapter.quote("TelephoneCode") }} as telephone_code, + {{ adapter.quote("TelephoneNumber") }} as guest_phone_number_2, + {{ adapter.quote("LinkUsed") }} as link_used_at_utc, + cast({{ adapter.quote("LinkUsed") }} as date) as link_used_date_utc, + {{ adapter.quote("ExpiryDate") }} as expire_at_utc, + cast({{ adapter.quote("ExpiryDate") }} as date) as expire_date_utc, + {{ adapter.quote("Deleted") }} as is_deleted, + {{ adapter.quote("RedirectName") }} as redirect_name, + {{ adapter.quote("OneStepLinkId") }} as id_one_step_link, + {{ adapter.quote("SuccessMessage") }} as success_message, + {{ adapter.quote("Summary") }} as summary, + {{ adapter.quote("RejectionReason") }} as rejection_reason, + {{ adapter.quote("SwitchedToMobile") }} as has_switched_to_mobile, + {{ adapter.quote("VerifierRejected") }} as is_verifier_rejected, + {{ adapter.quote("Config") }} as config, + {{ adapter.quote("MetaData") }} as metadata, + {{ adapter.quote("CreatedDate") }} as created_at_utc, + cast({{ adapter.quote("CreatedDate") }} as date) as created_date_utc, + {{ adapter.quote("UpdatedDate") }} as updated_at_utc, + cast({{ adapter.quote("UpdatedDate") }} as date) as updated_date_utc, + {{ adapter.quote("_airbyte_extracted_at") }} as dwh_extracted_at_utc + from raw_verification_request + ) +select * +from stg_core__verification_request From 14b779ffa7d71e2617a6d90bae47f2c7db521431 Mon Sep 17 00:00:00 2001 From: Pablo Martin Date: Mon, 18 Mar 2024 13:02:15 +0100 Subject: [PATCH 5/5] remove verification: we won't use it yet --- models/staging/core/_core_sources.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/models/staging/core/_core_sources.yml b/models/staging/core/_core_sources.yml index e97e52e..502c86f 100644 --- a/models/staging/core/_core_sources.yml +++ b/models/staging/core/_core_sources.yml @@ -169,8 +169,6 @@ sources: description: "{{ doc('_airbyte_meta_desc') }}" - name: superhog_user identifier: SuperhogUser - - name: Verification - identifier: Verification - name: VerificationRequest identifier: VerificationRequest - name: VerificationToPayment