16 lines
556 B
SQL
16 lines
556 B
SQL
{%- set ids = var('identifiers') %}
|
|
with identity as (
|
|
select * from {{ source('bronze', 'staged__identity') }}
|
|
where _held is null and person_id is not null
|
|
)
|
|
{%- for field, system in ids.items() %}
|
|
select distinct person_id, '{{ system }}' as system, {{ field }} as value
|
|
from identity where {{ field }} is not null
|
|
union
|
|
{%- endfor %}
|
|
select distinct
|
|
person_id,
|
|
{{ dbt.concat(["'" ~ var('record_number_system') ~ "'", '_pipeline', "':'", '_source']) }} as system,
|
|
record_number as value
|
|
from identity where record_number is not null
|