Adding STATE field as a primary key
This commit is contained in:
parent
72fd1ffba5
commit
6bf5bc7037
@ -1,10 +1,10 @@
|
|||||||
config {
|
config {
|
||||||
type: "incremental",
|
type: "incremental",
|
||||||
uniqueKey: ["AGENT_ID", "TIMESTAMP"],
|
uniqueKey: ["AGENT_ID", "TIMESTAMP", "STATE"],
|
||||||
schema: "pphe_five9_stg",
|
schema: "pphe_five9_stg",
|
||||||
assertions: {
|
assertions: {
|
||||||
uniqueKey: ["AGENT_ID", "TIMESTAMP"],
|
uniqueKey: ["AGENT_ID", "TIMESTAMP", "STATE"],
|
||||||
nonNull: ["AGENT_ID", "TIMESTAMP"]
|
nonNull: ["AGENT_ID", "TIMESTAMP", "STATE"]
|
||||||
},
|
},
|
||||||
dependencies: ["agent_status_data_freshness"],
|
dependencies: ["agent_status_data_freshness"],
|
||||||
description: "All history data for agent status"
|
description: "All history data for agent status"
|
||||||
@ -14,7 +14,7 @@ config {
|
|||||||
with agent_status_deduplicated as (
|
with agent_status_deduplicated as (
|
||||||
select *,
|
select *,
|
||||||
ROW_NUMBER()
|
ROW_NUMBER()
|
||||||
OVER (PARTITION BY AGENT_ID, TIMESTAMP)
|
OVER (PARTITION BY AGENT_ID, TIMESTAMP, STATE)
|
||||||
row_number
|
row_number
|
||||||
from ${ref("pphe_five9_raw","agent_status_*")}
|
from ${ref("pphe_five9_raw","agent_status_*")}
|
||||||
${ when(incremental(), `where _TABLE_SUFFIX = FORMAT_DATE('%Y%m%d',current_date("Europe/Amsterdam"))`) }) --last date table is taken
|
${ when(incremental(), `where _TABLE_SUFFIX = FORMAT_DATE('%Y%m%d',current_date("Europe/Amsterdam"))`) }) --last date table is taken
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user