12 lines
361 B
SQL
12 lines
361 B
SQL
with ranked as (
|
|
select
|
|
person_id, date,
|
|
row_number() over (partition by person_id order by date, source_table, source_id) as n
|
|
from {{ ref('cacu_events') }}
|
|
where date <= {{ as_of() }} and source_table <> 'person'
|
|
)
|
|
|
|
select person_id, date as index_date, cast(null as {{ dbt.type_string() }}) as excluded_by
|
|
from ranked
|
|
where n = 1
|