csc table first look
This commit is contained in:
parent
be5195ab58
commit
fb7769af41
31
definitions/staging/stg_csc_agent.sqlx
Normal file
31
definitions/staging/stg_csc_agent.sqlx
Normal 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
|
||||||
Loading…
Reference in New Issue
Block a user