Update of users table
This commit is contained in:
parent
cb1f00849d
commit
7ea70d3f4c
2 changed files with 20 additions and 6 deletions
|
|
@ -51,7 +51,7 @@ exposures:
|
||||||
depends_on:
|
depends_on:
|
||||||
- ref('xero__net_fees_by_deal')
|
- ref('xero__net_fees_by_deal')
|
||||||
- ref('edeposit__guesty_verifications')
|
- ref('edeposit__guesty_verifications')
|
||||||
- ref('edeposit__verifications_fees')
|
- ref('edeposit__verification_fees')
|
||||||
|
|
||||||
owner:
|
owner:
|
||||||
name: Oriol Roqué
|
name: Oriol Roqué
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
-- test users to filter out. In the update on Q4 they should either be removed or a
|
||||||
|
-- new field added to identify them.
|
||||||
{% set test_users = (
|
{% set test_users = (
|
||||||
"b2a6a51c-af04-419c-97c1-e08e26710651",
|
"b2a6a51c-af04-419c-97c1-e08e26710651",
|
||||||
"742086df-537d-46b5-8865-548d85c3dc5c",
|
"742086df-537d-46b5-8865-548d85c3dc5c",
|
||||||
|
|
@ -12,8 +14,21 @@
|
||||||
"d327a19d-6111-4364-b27c-02253d093045",
|
"d327a19d-6111-4364-b27c-02253d093045",
|
||||||
"61029f39-fb8a-4160-9353-d5d441147a42",
|
"61029f39-fb8a-4160-9353-d5d441147a42",
|
||||||
) %}
|
) %}
|
||||||
-- test users to filter out. In the update on Q4 they should either be removed or a
|
-- mapping of users that have a different id in Cosmos DB so we keep those
|
||||||
-- new field added to identify them.
|
{% set mapped_users = {
|
||||||
|
"6580e7a6da7d1d09344c847d": "011339af-1206-4b4b-bd58-db2588381673",
|
||||||
|
"3f6e171e-b6a3-4e5d-b178-309cd91fa704": "e2a34440-c382-4352-bb57-60e898752826",
|
||||||
|
"hello-manhattanbnb-com": "b1e28c21-ddc2-4c2b-9207-62e248ff83aa",
|
||||||
|
"9471281a-6404-4614-8cf3-66b1c24e6f24": "e2fa2f20-4fcf-4736-b5e5-f8b118ca98fe",
|
||||||
|
} %}
|
||||||
|
{% set user_mapping_case %}
|
||||||
|
case
|
||||||
|
{% for old_user, new_user in mapped_users.items() %}
|
||||||
|
when lower({{ adapter.quote("UserId") }}) = '{{ old_user }}' then '{{ new_user }}'
|
||||||
|
{% endfor %}
|
||||||
|
else lower({{ adapter.quote("UserId") }})
|
||||||
|
end
|
||||||
|
{% endset %}
|
||||||
with
|
with
|
||||||
raw_electronic_deposit_user as (
|
raw_electronic_deposit_user as (
|
||||||
select * from {{ source("core", "ElectronicDepositUser") }}
|
select * from {{ source("core", "ElectronicDepositUser") }}
|
||||||
|
|
@ -21,11 +36,11 @@ with
|
||||||
stg_core__edeposit_user as (
|
stg_core__edeposit_user as (
|
||||||
select
|
select
|
||||||
{{ adapter.quote("Id") }} as id,
|
{{ adapter.quote("Id") }} as id,
|
||||||
lower({{ adapter.quote("UserId") }}) as id_user_partner,
|
{{ user_mapping_case }} 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
|
-- this shitty thing right here is all because the currency is currently
|
||||||
-- set up as a free text.
|
-- set up as a free text.
|
||||||
-- they expect to fix this on the next update of E-deposit
|
-- they expect to fix this on the next update of E-deposit
|
||||||
|
upper(substring({{ adapter.quote("Currency") }} from 1 for 3)) as currency,
|
||||||
{{ adapter.quote("NightlyFee") }} as nightly_fee,
|
{{ adapter.quote("NightlyFee") }} as nightly_fee,
|
||||||
{{ adapter.quote("CancellationFee") }} as cancellation_fee,
|
{{ adapter.quote("CancellationFee") }} as cancellation_fee,
|
||||||
{{ adapter.quote("ProtectionLowerLevel") }} as protection_lower_level,
|
{{ adapter.quote("ProtectionLowerLevel") }} as protection_lower_level,
|
||||||
|
|
@ -33,7 +48,6 @@ with
|
||||||
{{ adapter.quote("CreatedDate") }} as created_at_utc,
|
{{ adapter.quote("CreatedDate") }} as created_at_utc,
|
||||||
{{ adapter.quote("UpdatedDate") }} as updated_at_utc,
|
{{ adapter.quote("UpdatedDate") }} as updated_at_utc,
|
||||||
{{ adapter.quote("_airbyte_extracted_at") }} as dwh_extracted_at_utc
|
{{ adapter.quote("_airbyte_extracted_at") }} as dwh_extracted_at_utc
|
||||||
|
|
||||||
from raw_electronic_deposit_user
|
from raw_electronic_deposit_user
|
||||||
)
|
)
|
||||||
select *
|
select *
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue