Merged PR 2707: E-Deposit users to staging
# Description E-Deposit users to staging to have currencies for PBI report # 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 - [ ] Check if a full-refresh is required after this PR is merged. Related work items: #20125
This commit is contained in:
commit
0cb03e0808
3 changed files with 127 additions and 2 deletions
|
|
@ -230,4 +230,6 @@ sources:
|
|||
- name: VerificationToAddressValidation
|
||||
identifier: VerificationToAddressValidation
|
||||
- name: AccommodationToProductBundle
|
||||
identifier: AccommodationToProductBundle
|
||||
identifier: AccommodationToProductBundle
|
||||
- name: ElectronicDepositUser
|
||||
identifier: ElectronicDepositUser
|
||||
|
|
@ -193,4 +193,86 @@ models:
|
|||
- name: id_accommodation_to_product_bundle
|
||||
tests:
|
||||
- unique
|
||||
- not_null
|
||||
- not_null
|
||||
- name: stg_core__edeposit_user
|
||||
description:
|
||||
"This table contains data on partner users for E-deposit,
|
||||
their currencies and amount of protection according to the
|
||||
level given on the verification"
|
||||
columns:
|
||||
- name: id
|
||||
data_type: bigint
|
||||
description: "Record id for this table"
|
||||
tests:
|
||||
- unique
|
||||
- not_null
|
||||
|
||||
- name: id_user_partner
|
||||
data_type: character varying
|
||||
description: "Unique id for partner user"
|
||||
tests:
|
||||
- unique
|
||||
- not_null
|
||||
|
||||
- name: currency
|
||||
data_type: character varying
|
||||
description:
|
||||
"Three-letter ISO code assigned to the currency used by user."
|
||||
tests:
|
||||
- not_null
|
||||
- dbt_expectations.expect_column_values_to_match_regex:
|
||||
regex: "^[A-Z]{3}$"
|
||||
|
||||
- name: nightly_fee
|
||||
data_type: numeric
|
||||
description: "Fee charged per night on booking"
|
||||
tests:
|
||||
- not_null
|
||||
- dbt_expectations.expect_column_values_to_be_between:
|
||||
min_value: 0
|
||||
max_value: 100
|
||||
strictly: true
|
||||
|
||||
- name: cancellation_fee
|
||||
data_type: numeric
|
||||
description: "Fee charged per cancelled booking"
|
||||
tests:
|
||||
- not_null
|
||||
- dbt_expectations.expect_column_values_to_be_between:
|
||||
min_value: 0
|
||||
max_value: 100
|
||||
strictly: true
|
||||
|
||||
- name: protection_lower_level
|
||||
data_type: numeric
|
||||
description: "Amount of protection given when verification is 'Passed'"
|
||||
tests:
|
||||
- not_null
|
||||
- dbt_expectations.expect_column_values_to_be_between:
|
||||
min_value: 0
|
||||
strictly: true
|
||||
|
||||
- name: protection_upper_level
|
||||
data_type: numeric
|
||||
description: "Amount of protection given when verification is 'Flagged'"
|
||||
tests:
|
||||
- not_null
|
||||
- dbt_expectations.expect_column_values_to_be_between:
|
||||
min_value: 0
|
||||
strictly: true
|
||||
|
||||
- name: created_at_utc
|
||||
data_type: timestamp without time zone
|
||||
description: "Timestamp of when user was created"
|
||||
tests:
|
||||
- not_null
|
||||
|
||||
- name: updated_at_utc
|
||||
data_type: timestamp without time zone
|
||||
description: "Timestamp of when user was last updated"
|
||||
tests:
|
||||
- not_null
|
||||
|
||||
- name: dwh_extracted_at_utc
|
||||
data_type: timestamp with time zone
|
||||
description: "Timestamp of when data was extracted to DWH"
|
||||
41
models/staging/core/stg_core__edeposit_user.sql
Normal file
41
models/staging/core/stg_core__edeposit_user.sql
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
{% set test_users = (
|
||||
"b2a6a51c-af04-419c-97c1-e08e26710651",
|
||||
"742086df-537d-46b5-8865-548d85c3dc5c",
|
||||
"eb39d9fe-cf1e-41d3-b770-1d83e8375f4c",
|
||||
"c98dc29c-cf48-479d-932f-b8507e74a0e8",
|
||||
"134a4730-698a-4b6c-8564-33420b37d018",
|
||||
"1dd9158f-ddac-4c29-8656-dcfe840e1ec5",
|
||||
"e72e209d-31d2-47bf-a435-d488fa070cb4",
|
||||
"06175d54-6084-4786-95a7-2aebd3ded676",
|
||||
"844fd33d-f34a-43e2-921b-8dce952add1a",
|
||||
"c218e0c2-9dad-469a-8eb7-535d8c264f74",
|
||||
"d327a19d-6111-4364-b27c-02253d093045",
|
||||
"61029f39-fb8a-4160-9353-d5d441147a42",
|
||||
) %}
|
||||
-- test users to filter out. In the update on Q4 they should either be removed or a
|
||||
-- new field added to identify them.
|
||||
with
|
||||
raw_electronic_deposit_user as (
|
||||
select * from {{ source("core", "ElectronicDepositUser") }}
|
||||
),
|
||||
stg_core__edeposit_user as (
|
||||
select
|
||||
{{ adapter.quote("Id") }} as id,
|
||||
{{ adapter.quote("UserId") }} as id_user_partner,
|
||||
upper(substring({{ adapter.quote("Currency") }} from 1 for 3)) as currency,
|
||||
-- this shitty thing right here is all because the currency is currently
|
||||
-- set up as a free text.
|
||||
-- they expect to fix this on the next update of E-deposit
|
||||
{{ adapter.quote("NightlyFee") }} as nightly_fee,
|
||||
{{ adapter.quote("CancellationFee") }} as cancellation_fee,
|
||||
{{ adapter.quote("ProtectionLowerLevel") }} as protection_lower_level,
|
||||
{{ adapter.quote("ProtectionUpperLevel") }} as protection_upper_level,
|
||||
{{ adapter.quote("CreatedDate") }} as created_at_utc,
|
||||
{{ adapter.quote("UpdatedDate") }} as updated_at_utc,
|
||||
{{ adapter.quote("_airbyte_extracted_at") }} as dwh_extracted_at_utc
|
||||
|
||||
from raw_electronic_deposit_user
|
||||
)
|
||||
select *
|
||||
from stg_core__edeposit_user
|
||||
where id_user_partner not in {{ test_users }}
|
||||
Loading…
Add table
Add a link
Reference in a new issue