Merged PR 3539: Normalise service names and create booking to service table
# Description Goal of the PR is start modelising the Services and Revenue for New Dash/New Pricing. Be aware that this is a first model and it's not by all means the definitive nor complete version. Changes: * Services name normalisation: It's a bit painful because we usually had two names: 'MyService' and 'My Service'. The initial setup I built was considering the first, but in some new integrated tables it only has the second. So I just standardised everything to be in upper case and with spaces such as 'MY SERVICE'. Might make more sense later on. This affects many existing models. * Compute a new Service Business Type field in `stg_core__product_service`: Main reason is that effectively Platform scope in New Pricing have business differences in the services types but this does not exist in the backend. I do it at staging level with a dedicated accepted values test to ensure any new update is captured and notified. You can read more about the business logic in this [Notion page](https://www.notion.so/knowyourguest-superhog/All-Services-Definitions-333fba1fbed54715b6b1c3b5133f0d4f). * Create a new model `int_core__booking_to_service`: this model joins the information of BookingViewToService with BookingView and Booking tables to retrieve a more consolidated version of what we will needed downstream for the future table of Booking Service Detail and the Aggregated version (not included in this PR). This table likely can be enriched in future PRs. At the moment it just contains the bare minimum fields needed for the lines/aggregated versions. (NB: Booking information is needed, for instance, for the services which unit price need to be applied for the number of nights of the booking) # Checklist - [X] The edited models and dependants run properly with production data. - [X] 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. - [X] I've picked the right materialization for the affected models. # Other - [X] Check if a full-refresh is required after this PR is merged. **stg_core__booking_view_to_service needs full refresh** Related work items: #20809
This commit is contained in:
parent
321f48ca7d
commit
c209e670ca
13 changed files with 224 additions and 19 deletions
|
|
@ -1994,7 +1994,7 @@ models:
|
|||
- name: product_bundle_name
|
||||
data_type: string
|
||||
description: |
|
||||
The CamelCase name of the Product Bundle.
|
||||
The name of the Product Bundle.
|
||||
|
||||
- name: product_bundle_display_name
|
||||
data_type: string
|
||||
|
|
@ -2150,7 +2150,7 @@ models:
|
|||
- name: product_bundle_name
|
||||
data_type: string
|
||||
description: |
|
||||
The CamelCase name of the Product Bundle.
|
||||
The name of the Product Bundle.
|
||||
|
||||
- name: created_at_utc
|
||||
data_type: timestamp
|
||||
|
|
@ -2241,7 +2241,7 @@ models:
|
|||
- name: product_bundle_name
|
||||
data_type: string
|
||||
description: |
|
||||
The CamelCase name of the Product Bundle.
|
||||
The name of the Product Bundle.
|
||||
|
||||
- name: original_starts_at_utc
|
||||
data_type: timestamp
|
||||
|
|
@ -2818,14 +2818,14 @@ models:
|
|||
- name: product_bundle_name
|
||||
data_type: string
|
||||
description: |
|
||||
The CamelCase name of the product bundle.
|
||||
The name of the product bundle.
|
||||
tests:
|
||||
- not_null
|
||||
|
||||
- name: product_service_name
|
||||
data_type: string
|
||||
description: |
|
||||
The CamelCase name of the product service.
|
||||
The name of the product service.
|
||||
tests:
|
||||
- not_null
|
||||
|
||||
|
|
@ -3149,3 +3149,136 @@ models:
|
|||
Timestamp of when this data was extracted into DWH.
|
||||
tests:
|
||||
- not_null
|
||||
|
||||
- name: int_core__booking_to_service
|
||||
description: |
|
||||
This model contains the information of which booking has a certain
|
||||
service applied. It's a subset of all bookings since it only
|
||||
applies to bookings that come from hosts that have been migrated into
|
||||
the New Dash or New Pricing.
|
||||
|
||||
tests:
|
||||
- dbt_expectations.expect_column_pair_values_A_to_be_greater_than_B:
|
||||
column_A: booking_check_out_at_utc
|
||||
column_B: booking_check_in_at_utc
|
||||
or_equal: True
|
||||
- dbt_expectations.expect_column_pair_values_A_to_be_greater_than_B:
|
||||
column_A: service_detail_created_at_utc
|
||||
column_B: booking_created_at_utc
|
||||
or_equal: True
|
||||
- dbt_expectations.expect_column_pair_values_A_to_be_greater_than_B:
|
||||
column_A: service_detail_updated_at_utc
|
||||
column_B: service_detail_created_at_utc
|
||||
or_equal: True
|
||||
|
||||
columns:
|
||||
- name: id_booking
|
||||
data_type: bigint
|
||||
description: |
|
||||
The identifier of the booking. Acts as Foreign Key to Booking table.
|
||||
Cannot be null.
|
||||
tests:
|
||||
- not_null
|
||||
|
||||
- name: id_booking_service_detail
|
||||
data_type: bigint
|
||||
description: |
|
||||
The identifier of the booking that has a certain service applied.
|
||||
The same booking can have multiple services applied and would
|
||||
have distinct id_booking_service_detail.
|
||||
tests:
|
||||
- not_null
|
||||
- unique
|
||||
|
||||
- name: id_verification
|
||||
data_type: bigint
|
||||
description: |
|
||||
The identifier of the verification. It acts as Foreign Key to Verification
|
||||
table. It can be null.
|
||||
|
||||
- name: id_product_service
|
||||
data_type: bigint
|
||||
description: |
|
||||
The identifier of the product service. It acts as Foreign Key to Product
|
||||
Service table. It can be null.
|
||||
|
||||
- name: id_protection_plan
|
||||
data_type: bigint
|
||||
description: |
|
||||
The identifier of the protection plan, aka protection service. It acts as
|
||||
Foreign Key to Product Plan table. It can be null.
|
||||
|
||||
- name: service_status
|
||||
data_type: string
|
||||
description: |
|
||||
The status of the service applied within the booking. Cannot be null.
|
||||
tests:
|
||||
- not_null
|
||||
|
||||
- name: service_name
|
||||
data_type: string
|
||||
description: |
|
||||
The name of the service applied within the booking. Cannot be null.
|
||||
tests:
|
||||
- not_null
|
||||
|
||||
- name: service_protection_amount
|
||||
data_type: string
|
||||
description: |
|
||||
The amount protected given for the service applied within the booking.
|
||||
Cannot be null.
|
||||
tests:
|
||||
- not_null
|
||||
|
||||
- name: service_detail_created_at_utc
|
||||
data_type: timestamp
|
||||
description: |
|
||||
Timestamp of when this Service row was created in the Backend.
|
||||
tests:
|
||||
- not_null
|
||||
|
||||
- name: service_detail_updated_at_utc
|
||||
data_type: timestamp
|
||||
description: |
|
||||
Timestamp of when this Service row was last updated in the Backend.
|
||||
tests:
|
||||
- not_null
|
||||
|
||||
- name: booking_created_at_utc
|
||||
data_type: timestamp
|
||||
description: |
|
||||
Timestamp of when the Booking row was created in the Backend.
|
||||
tests:
|
||||
- not_null
|
||||
|
||||
- name: booking_check_in_at_utc
|
||||
data_type: timestamp
|
||||
description: |
|
||||
Timestamp of the Check-in of the Booking.
|
||||
tests:
|
||||
- not_null
|
||||
|
||||
- name: booking_check_out_at_utc
|
||||
data_type: timestamp
|
||||
description: |
|
||||
Timestamp of the Check-out of the Booking.
|
||||
tests:
|
||||
- not_null
|
||||
|
||||
- name: id_user_host
|
||||
data_type: string
|
||||
description: |
|
||||
Unique identifier of the user that acts as Host.
|
||||
tests:
|
||||
- not_null
|
||||
|
||||
- name: host_currency_code
|
||||
data_type: string
|
||||
description: |
|
||||
Iso 4217 currency code for the account of the Host.
|
||||
It can be null.
|
||||
|
||||
- name: is_missing_host_currency_code
|
||||
data_type: boolean
|
||||
description: |
|
||||
Flag to identify if the host is missing the currency code.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue