csc table first look

This commit is contained in:
Anna Saiapina 2024-11-19 15:53:24 +00:00 committed by GCP Dataform
parent be5195ab58
commit fb7769af41

View File

@ -0,0 +1,31 @@
config {
type: "incremental",
uniqueKey: ["RESORT", "CONFIRMATION_NO", "CHANGE_DATE"],
schema: "pphe_five9_stg",
assertions: {
uniqueKey: ["RESORT", "CONFIRMATION_NO", "CHANGE_DATE"],
nonNull: ["RESORT", "CONFIRMATION_NO", "CHANGE_DATE"]
},
description: "All history data for csc revenue changes"
}
--Numerates by key for deduplication
with csc_rev_deduplicated as (
select *,
ROW_NUMBER()
OVER (PARTITION BY RESORT, CONFIRMATION_NO, CHANGE_DATE)
row_number
from ${ref("pphe_five9_raw","csc_rev_changes_*")}
${ when(incremental(), `where _TABLE_SUFFIX = FORMAT_DATE('%Y%m%d',current_date("Europe/Amsterdam"))`) }) --last date table is taken
select RESORT,
MARKET_CODE,
MARKET_DESC,
CONFIRMATION_NO,
RESV_STATUS,
ARRIVAL,
DEPARTURE,
UPDATE_USER,
CHANGE_DATE,
UPDATE_TYPE,
from csc_rev_deduplicated
where row_number = 1