Add deduplication
This commit is contained in:
parent
16bf93a06c
commit
ccb919db03
@ -9,8 +9,15 @@ config {
|
||||
tags: ["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,
|
||||
CAMPAIGN,
|
||||
SKILL,
|
||||
@ -209,5 +216,5 @@ select DAY_OF_WEEK,
|
||||
Social_Category SOCIAL_CATEGORY,
|
||||
Social_socialId SOCIAL_SOCIALID,
|
||||
Studio_transfer_disposition STUDIO_TRANSFER_DISPOSITION
|
||||
from ${ref("calls_*")}
|
||||
${ when(incremental(), `where _TABLE_SUFFIX = FORMAT_DATE('%Y%m%d',current_date("Europe/Amsterdam"))`) }
|
||||
from calls_deduplicated
|
||||
where row_number = 1
|
||||
Loading…
Reference in New Issue
Block a user