Add deduplication
This commit is contained in:
parent
16bf93a06c
commit
ccb919db03
@ -9,8 +9,15 @@ config {
|
|||||||
tags: ["calls"],
|
tags: ["calls"],
|
||||||
description: "All history data for calls"
|
description: "All history data for calls"
|
||||||
}
|
}
|
||||||
|
|
||||||
select DAY_OF_WEEK,
|
with calls_deduplicated as (
|
||||||
|
select *,
|
||||||
|
ROW_NUMBER()
|
||||||
|
OVER (PARTITION BY SESSION_ID, TIMESTAMP, DNIS)
|
||||||
|
row_number
|
||||||
|
from ${ref("calls_*")}
|
||||||
|
${ when(incremental(), `where _TABLE_SUFFIX = FORMAT_DATE('%Y%m%d',current_date("Europe/Amsterdam"))`) })
|
||||||
|
select DAY_OF_WEEK,
|
||||||
CALL_ID,
|
CALL_ID,
|
||||||
CAMPAIGN,
|
CAMPAIGN,
|
||||||
SKILL,
|
SKILL,
|
||||||
@ -209,5 +216,5 @@ select DAY_OF_WEEK,
|
|||||||
Social_Category SOCIAL_CATEGORY,
|
Social_Category SOCIAL_CATEGORY,
|
||||||
Social_socialId SOCIAL_SOCIALID,
|
Social_socialId SOCIAL_SOCIALID,
|
||||||
Studio_transfer_disposition STUDIO_TRANSFER_DISPOSITION
|
Studio_transfer_disposition STUDIO_TRANSFER_DISPOSITION
|
||||||
from ${ref("calls_*")}
|
from calls_deduplicated
|
||||||
${ when(incremental(), `where _TABLE_SUFFIX = FORMAT_DATE('%Y%m%d',current_date("Europe/Amsterdam"))`) }
|
where row_number = 1
|
||||||
Loading…
Reference in New Issue
Block a user