Added schema
This commit is contained in:
parent
28f7486634
commit
105f2aee45
2 changed files with 98 additions and 0 deletions
|
|
@ -0,0 +1,18 @@
|
||||||
|
with
|
||||||
|
int_check_in_hero__checkins as (
|
||||||
|
select * from {{ ref("int_check_in_hero__checkins") }}
|
||||||
|
)
|
||||||
|
|
||||||
|
select
|
||||||
|
id_user_partner,
|
||||||
|
extract('year' from created_date_utc) as year,
|
||||||
|
extract('month' from created_date_utc) as month,
|
||||||
|
to_char(created_date_utc, 'Month') as month_name,
|
||||||
|
id_currency,
|
||||||
|
currency_code,
|
||||||
|
sum(booking_fee_in_local_currency) as total_fee_in_local_currency,
|
||||||
|
count(distinct id_record) as number_of_requests,
|
||||||
|
company_name,
|
||||||
|
user_email
|
||||||
|
from int_check_in_hero__checkins
|
||||||
|
group by 1, 2, 3, 4, 5, 6, 9, 10
|
||||||
|
|
@ -181,3 +181,83 @@ models:
|
||||||
description: Date when the record was created.
|
description: Date when the record was created.
|
||||||
data_tests:
|
data_tests:
|
||||||
- not_null
|
- not_null
|
||||||
|
|
||||||
|
- name: int_check_in_hero__user_monthly_fee
|
||||||
|
description: |
|
||||||
|
Table that shows the total monthly fee for each user.
|
||||||
|
These charges are calculated based on the amount of request created
|
||||||
|
for each user partner that will be invoiced at the beginning of the
|
||||||
|
following month.
|
||||||
|
columns:
|
||||||
|
- name: id_user_partner
|
||||||
|
data_type: text
|
||||||
|
description: |
|
||||||
|
Identifier for the partner user associated with the check-in.
|
||||||
|
data_tests:
|
||||||
|
- not_null
|
||||||
|
|
||||||
|
- name: year
|
||||||
|
data_type: integer
|
||||||
|
description: |
|
||||||
|
Year when the charges are created. This is obtained from the
|
||||||
|
creation date of each record.
|
||||||
|
data_tests:
|
||||||
|
- not_null
|
||||||
|
|
||||||
|
- name: month
|
||||||
|
data_type: integer
|
||||||
|
description: |
|
||||||
|
Month number when the charges are created. This is obtained from the
|
||||||
|
creation date of each record.
|
||||||
|
data_tests:
|
||||||
|
- not_null
|
||||||
|
|
||||||
|
- name: month_name
|
||||||
|
data_type: text
|
||||||
|
description: |
|
||||||
|
Month name when the charges are created. This is obtained from the
|
||||||
|
creation date of each record.
|
||||||
|
data_tests:
|
||||||
|
- not_null
|
||||||
|
|
||||||
|
- name: id_currency
|
||||||
|
data_type: bigint
|
||||||
|
description: "Id of the currency, works as a foreign key to the
|
||||||
|
currency table"
|
||||||
|
data_tests:
|
||||||
|
- not_null
|
||||||
|
- relationships:
|
||||||
|
to: ref('stg_core__currency')
|
||||||
|
field: id_currency
|
||||||
|
|
||||||
|
- name: currency_code
|
||||||
|
data_type: character varying
|
||||||
|
description: Currency ISO 4217 code used by user.
|
||||||
|
data_tests:
|
||||||
|
- not_null
|
||||||
|
|
||||||
|
- name: total_fee_in_local_currency
|
||||||
|
data_type: numeric
|
||||||
|
description: "Total fee charged to the user for the month in the local currency."
|
||||||
|
data_tests:
|
||||||
|
- dbt_expectations.expect_column_values_to_be_between:
|
||||||
|
min_value: 0
|
||||||
|
max_value: 1000000
|
||||||
|
strictly: true
|
||||||
|
|
||||||
|
- name: number_of_requests
|
||||||
|
data_type: numeric
|
||||||
|
description: "Count of requests created by the user partner for the month."
|
||||||
|
data_tests:
|
||||||
|
- dbt_expectations.expect_column_values_to_be_between:
|
||||||
|
min_value: 0
|
||||||
|
max_value: 10000
|
||||||
|
strictly: true
|
||||||
|
|
||||||
|
- 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.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue