Check in Hero models
This commit is contained in:
parent
af7a194840
commit
cbb93982d0
4 changed files with 386 additions and 0 deletions
|
|
@ -0,0 +1,46 @@
|
||||||
|
{% set api_name = "CHECKINHEROAPI" %}
|
||||||
|
|
||||||
|
with
|
||||||
|
stg_check_in_hero__checkins as (
|
||||||
|
select * from {{ ref("stg_check_in_hero__checkins") }}
|
||||||
|
),
|
||||||
|
stg_core__apim_user as (select * from {{ ref("stg_core__apim_user") }}),
|
||||||
|
stg_core__apim_user_type as (select * from {{ ref("stg_core__apim_user_type") }}),
|
||||||
|
stg_core__user as (select * from {{ ref("stg_core__user") }})
|
||||||
|
|
||||||
|
select
|
||||||
|
c.id_record,
|
||||||
|
c.id_user_partner,
|
||||||
|
c.id_reservation,
|
||||||
|
c.id_accommodation,
|
||||||
|
c.guest_last_name,
|
||||||
|
c.guest_first_name,
|
||||||
|
c.guest_email,
|
||||||
|
c.guest_telephone,
|
||||||
|
c.number_of_guests,
|
||||||
|
c.reservation_total_amount_in_local_currency,
|
||||||
|
c.reservation_currency,
|
||||||
|
c.channel,
|
||||||
|
c.checkin_date_utc,
|
||||||
|
c.checkin_time_utc,
|
||||||
|
c.checkout_date_utc,
|
||||||
|
c.listing_name,
|
||||||
|
c.listing_address,
|
||||||
|
c.listing_address_line_2,
|
||||||
|
c.listing_town,
|
||||||
|
c.listing_country,
|
||||||
|
c.listing_postcode,
|
||||||
|
u.company_name,
|
||||||
|
c.user_email,
|
||||||
|
c.updated_at_utc,
|
||||||
|
c.updated_date_utc,
|
||||||
|
c.cosmos_creation_at_utc,
|
||||||
|
c.cosmos_creation_date_utc,
|
||||||
|
c.created_date_utc
|
||||||
|
from stg_check_in_hero__checkins c
|
||||||
|
inner join stg_core__apim_user au on c.id_user_partner = au.id_apim_user
|
||||||
|
inner join
|
||||||
|
stg_core__apim_user_type aut
|
||||||
|
on au.id_apim_user_type = aut.id_apim_user_type
|
||||||
|
and upper(aut.user_type_name) = '{{ api_name }}'
|
||||||
|
inner join stg_core__user u on u.id_user = au.id_apim_user
|
||||||
151
models/intermediate/check_in_hero/schema.yml
Normal file
151
models/intermediate/check_in_hero/schema.yml
Normal file
|
|
@ -0,0 +1,151 @@
|
||||||
|
version: 2
|
||||||
|
|
||||||
|
models:
|
||||||
|
- name: int_check_in_hero__checkins
|
||||||
|
description: |
|
||||||
|
Records of checkins using Checkin Hero API, capturing details about reservations,
|
||||||
|
guests, accommodations, and booking details.
|
||||||
|
columns:
|
||||||
|
- name: id_record
|
||||||
|
data_type: text
|
||||||
|
description: Unique identifier for the record.
|
||||||
|
tests:
|
||||||
|
- unique
|
||||||
|
- not_null
|
||||||
|
|
||||||
|
- name: id_user_partner
|
||||||
|
data_type: text
|
||||||
|
description: Identifier for the partner user associated with the check-in.
|
||||||
|
tests:
|
||||||
|
- not_null
|
||||||
|
|
||||||
|
- name: id_reservation
|
||||||
|
data_type: text
|
||||||
|
description: Unique identifier for the reservation associated with the check-in.
|
||||||
|
tests:
|
||||||
|
- not_null
|
||||||
|
|
||||||
|
- name: id_accommodation
|
||||||
|
data_type: text
|
||||||
|
description: Unique identifier for the accommodation associated with the reservation.
|
||||||
|
tests:
|
||||||
|
- not_null
|
||||||
|
|
||||||
|
- name: guest_last_name
|
||||||
|
data_type: text
|
||||||
|
description: Last name of the guest checking in.
|
||||||
|
|
||||||
|
- name: guest_first_name
|
||||||
|
data_type: text
|
||||||
|
description: First name of the guest checking in.
|
||||||
|
|
||||||
|
- name: guest_email
|
||||||
|
data_type: text
|
||||||
|
description: Email address of the guest checking in.
|
||||||
|
|
||||||
|
- name: guest_telephone
|
||||||
|
data_type: text
|
||||||
|
description: Telephone number of the guest checking in.
|
||||||
|
|
||||||
|
- name: number_of_guests
|
||||||
|
data_type: integer
|
||||||
|
description: Total number of guests included in the check-in.
|
||||||
|
|
||||||
|
- name: reservation_total_amount_in_local_currency
|
||||||
|
data_type: numeric
|
||||||
|
description: Total cost amount in guest currency for the reservation.
|
||||||
|
tests:
|
||||||
|
- dbt_expectations.expect_column_values_to_be_between:
|
||||||
|
min_value: 0
|
||||||
|
strictly: true
|
||||||
|
|
||||||
|
- name: reservation_currency
|
||||||
|
data_type: text
|
||||||
|
description: |
|
||||||
|
Currency ISO code used by guest for the reservation.
|
||||||
|
tests:
|
||||||
|
- not_null
|
||||||
|
|
||||||
|
- name: channel
|
||||||
|
data_type: text
|
||||||
|
description: Booking channel or source.
|
||||||
|
tests:
|
||||||
|
- not_null
|
||||||
|
|
||||||
|
- name: checkin_date_utc
|
||||||
|
data_type: date
|
||||||
|
description: Check-in date for the booking.
|
||||||
|
tests:
|
||||||
|
- not_null
|
||||||
|
|
||||||
|
- name: checkin_time_utc
|
||||||
|
data_type: time without time zone
|
||||||
|
description: Time of check-in for the booking.
|
||||||
|
|
||||||
|
- name: checkout_date_utc
|
||||||
|
data_type: date
|
||||||
|
description: Check-out date for the booking.
|
||||||
|
tests:
|
||||||
|
- not_null
|
||||||
|
|
||||||
|
- name: listing_name
|
||||||
|
data_type: text
|
||||||
|
description: Name of the listing associated with the check-in.
|
||||||
|
|
||||||
|
- name: listing_address
|
||||||
|
data_type: text
|
||||||
|
description: Address of the listing.
|
||||||
|
|
||||||
|
- name: listing_address_line_2
|
||||||
|
data_type: text
|
||||||
|
description: Additional address details for the listing.
|
||||||
|
|
||||||
|
- name: listing_town
|
||||||
|
data_type: text
|
||||||
|
description: Town or city where the listing is located.
|
||||||
|
|
||||||
|
- name: listing_country
|
||||||
|
data_type: text
|
||||||
|
description: Country code for the location of the listing.
|
||||||
|
|
||||||
|
- name: listing_postcode
|
||||||
|
data_type: text
|
||||||
|
description: Postal code for the listing.
|
||||||
|
|
||||||
|
- name: company_name
|
||||||
|
data_type: text
|
||||||
|
description: Company name of partner user.
|
||||||
|
|
||||||
|
- name: user_email
|
||||||
|
data_type: text
|
||||||
|
description: Email address of the user associated with the check-in.
|
||||||
|
|
||||||
|
- name: updated_at_utc
|
||||||
|
data_type: timestamp without time zone
|
||||||
|
description: Timestamp of the last update to the record.
|
||||||
|
tests:
|
||||||
|
- not_null
|
||||||
|
|
||||||
|
- name: updated_date_utc
|
||||||
|
data_type: date
|
||||||
|
description: Date of the last update to the record.
|
||||||
|
tests:
|
||||||
|
- not_null
|
||||||
|
|
||||||
|
- name: cosmos_creation_at_utc
|
||||||
|
data_type: timestamp without time zone
|
||||||
|
description: Timestamp when the record was created in Cosmos DB.
|
||||||
|
tests:
|
||||||
|
- not_null
|
||||||
|
|
||||||
|
- name: cosmos_creation_date_utc
|
||||||
|
data_type: date
|
||||||
|
description: Date when the record was created in Cosmos DB.
|
||||||
|
tests:
|
||||||
|
- not_null
|
||||||
|
|
||||||
|
- name: created_date_utc
|
||||||
|
data_type: date
|
||||||
|
description: Date when the record was created.
|
||||||
|
tests:
|
||||||
|
- not_null
|
||||||
38
models/reporting/check_in_hero/check_in_hero__checkins.sql
Normal file
38
models/reporting/check_in_hero/check_in_hero__checkins.sql
Normal file
|
|
@ -0,0 +1,38 @@
|
||||||
|
{% set api_name = "CHECKINHEROAPI" %}
|
||||||
|
|
||||||
|
with
|
||||||
|
int_check_in_hero__checkins as (
|
||||||
|
select * from {{ ref("int_check_in_hero__checkins") }}
|
||||||
|
)
|
||||||
|
|
||||||
|
select
|
||||||
|
id_record as id_record,
|
||||||
|
id_user_partner as id_user_partner,
|
||||||
|
id_reservation as id_reservation,
|
||||||
|
id_accommodation as id_accommodation,
|
||||||
|
guest_last_name as guest_last_name,
|
||||||
|
guest_first_name as guest_first_name,
|
||||||
|
guest_email as guest_email,
|
||||||
|
guest_telephone as guest_telephone,
|
||||||
|
number_of_guests as number_of_guests,
|
||||||
|
reservation_total_amount_in_local_currency
|
||||||
|
as reservation_total_amount_in_local_currency,
|
||||||
|
reservation_currency as reservation_currency,
|
||||||
|
channel as channel,
|
||||||
|
checkin_date_utc as checkin_date_utc,
|
||||||
|
checkin_time_utc as checkin_time_utc,
|
||||||
|
checkout_date_utc as checkout_date_utc,
|
||||||
|
listing_name as listing_name,
|
||||||
|
listing_address as listing_address,
|
||||||
|
listing_address_line_2 as listing_address_line_2,
|
||||||
|
listing_town as listing_town,
|
||||||
|
listing_country as listing_country,
|
||||||
|
listing_postcode as listing_postcode,
|
||||||
|
company_name as company_name,
|
||||||
|
user_email as user_email,
|
||||||
|
updated_at_utc as updated_at_utc,
|
||||||
|
updated_date_utc as updated_date_utc,
|
||||||
|
cosmos_creation_at_utc as cosmos_creation_at_utc,
|
||||||
|
cosmos_creation_date_utc as cosmos_creation_date_utc,
|
||||||
|
created_date_utc as created_date_utc
|
||||||
|
from int_check_in_hero__checkins
|
||||||
151
models/reporting/check_in_hero/schema.yml
Normal file
151
models/reporting/check_in_hero/schema.yml
Normal file
|
|
@ -0,0 +1,151 @@
|
||||||
|
version: 2
|
||||||
|
|
||||||
|
models:
|
||||||
|
- name: check_in_hero__checkins
|
||||||
|
description: |
|
||||||
|
Records of checkins using Checkin Hero API, capturing details about reservations,
|
||||||
|
guests, accommodations, and booking details.
|
||||||
|
columns:
|
||||||
|
- name: id_record
|
||||||
|
data_type: text
|
||||||
|
description: Unique identifier for the record.
|
||||||
|
tests:
|
||||||
|
- unique
|
||||||
|
- not_null
|
||||||
|
|
||||||
|
- name: id_user_partner
|
||||||
|
data_type: text
|
||||||
|
description: Identifier for the partner user associated with the check-in.
|
||||||
|
tests:
|
||||||
|
- not_null
|
||||||
|
|
||||||
|
- name: id_reservation
|
||||||
|
data_type: text
|
||||||
|
description: Unique identifier for the reservation associated with the check-in.
|
||||||
|
tests:
|
||||||
|
- not_null
|
||||||
|
|
||||||
|
- name: id_accommodation
|
||||||
|
data_type: text
|
||||||
|
description: Unique identifier for the accommodation associated with the reservation.
|
||||||
|
tests:
|
||||||
|
- not_null
|
||||||
|
|
||||||
|
- name: guest_last_name
|
||||||
|
data_type: text
|
||||||
|
description: Last name of the guest checking in.
|
||||||
|
|
||||||
|
- name: guest_first_name
|
||||||
|
data_type: text
|
||||||
|
description: First name of the guest checking in.
|
||||||
|
|
||||||
|
- name: guest_email
|
||||||
|
data_type: text
|
||||||
|
description: Email address of the guest checking in.
|
||||||
|
|
||||||
|
- name: guest_telephone
|
||||||
|
data_type: text
|
||||||
|
description: Telephone number of the guest checking in.
|
||||||
|
|
||||||
|
- name: number_of_guests
|
||||||
|
data_type: integer
|
||||||
|
description: Total number of guests included in the check-in.
|
||||||
|
|
||||||
|
- name: reservation_total_amount_in_local_currency
|
||||||
|
data_type: numeric
|
||||||
|
description: Total cost amount in guest currency for the reservation.
|
||||||
|
tests:
|
||||||
|
- dbt_expectations.expect_column_values_to_be_between:
|
||||||
|
min_value: 0
|
||||||
|
strictly: true
|
||||||
|
|
||||||
|
- name: reservation_currency
|
||||||
|
data_type: text
|
||||||
|
description: |
|
||||||
|
Currency ISO code used by guest for the reservation.
|
||||||
|
tests:
|
||||||
|
- not_null
|
||||||
|
|
||||||
|
- name: channel
|
||||||
|
data_type: text
|
||||||
|
description: Booking channel or source.
|
||||||
|
tests:
|
||||||
|
- not_null
|
||||||
|
|
||||||
|
- name: checkin_date_utc
|
||||||
|
data_type: date
|
||||||
|
description: Check-in date for the booking.
|
||||||
|
tests:
|
||||||
|
- not_null
|
||||||
|
|
||||||
|
- name: checkin_time_utc
|
||||||
|
data_type: time without time zone
|
||||||
|
description: Time of check-in for the booking.
|
||||||
|
|
||||||
|
- name: checkout_date_utc
|
||||||
|
data_type: date
|
||||||
|
description: Check-out date for the booking.
|
||||||
|
tests:
|
||||||
|
- not_null
|
||||||
|
|
||||||
|
- name: listing_name
|
||||||
|
data_type: text
|
||||||
|
description: Name of the listing associated with the check-in.
|
||||||
|
|
||||||
|
- name: listing_address
|
||||||
|
data_type: text
|
||||||
|
description: Address of the listing.
|
||||||
|
|
||||||
|
- name: listing_address_line_2
|
||||||
|
data_type: text
|
||||||
|
description: Additional address details for the listing.
|
||||||
|
|
||||||
|
- name: listing_town
|
||||||
|
data_type: text
|
||||||
|
description: Town or city where the listing is located.
|
||||||
|
|
||||||
|
- name: listing_country
|
||||||
|
data_type: text
|
||||||
|
description: Country code for the location of the listing.
|
||||||
|
|
||||||
|
- name: listing_postcode
|
||||||
|
data_type: text
|
||||||
|
description: Postal code for the listing.
|
||||||
|
|
||||||
|
- name: company_name
|
||||||
|
data_type: text
|
||||||
|
description: Company name of partner user.
|
||||||
|
|
||||||
|
- name: user_email
|
||||||
|
data_type: text
|
||||||
|
description: Email address of the user associated with the check-in.
|
||||||
|
|
||||||
|
- name: updated_at_utc
|
||||||
|
data_type: timestamp without time zone
|
||||||
|
description: Timestamp of the last update to the record.
|
||||||
|
tests:
|
||||||
|
- not_null
|
||||||
|
|
||||||
|
- name: updated_date_utc
|
||||||
|
data_type: date
|
||||||
|
description: Date of the last update to the record.
|
||||||
|
tests:
|
||||||
|
- not_null
|
||||||
|
|
||||||
|
- name: cosmos_creation_at_utc
|
||||||
|
data_type: timestamp without time zone
|
||||||
|
description: Timestamp when the record was created in Cosmos DB.
|
||||||
|
tests:
|
||||||
|
- not_null
|
||||||
|
|
||||||
|
- name: cosmos_creation_date_utc
|
||||||
|
data_type: date
|
||||||
|
description: Date when the record was created in Cosmos DB.
|
||||||
|
tests:
|
||||||
|
- not_null
|
||||||
|
|
||||||
|
- name: created_date_utc
|
||||||
|
data_type: date
|
||||||
|
description: Date when the record was created.
|
||||||
|
tests:
|
||||||
|
- not_null
|
||||||
Loading…
Add table
Add a link
Reference in a new issue