external-models/models/farcaster/gold/farcaster__fact_casts.sql
2024-07-16 13:19:56 -06:00

34 lines
613 B
SQL

{{ config(
materialized = 'view',
persist_docs ={ "relation": true,
"columns": true },
tags = ['farcaster'],
meta ={ 'database_tags':{ 'table':{ 'PROTOCOL': 'FARCASTER' } } }
) }}
SELECT
TIMESTAMP,
fid,
HASH,
parent_hash,
parent_fid,
parent_url,
text,
embeds,
mentions,
mentions_positions,
root_parent_hash,
root_parent_url,
id,
created_at,
updated_at,
deleted_at
FROM
{{ source(
'external_bronze',
'farcaster_casts'
) }}
qualify(ROW_NUMBER() over (PARTITION BY id
ORDER BY
updated_at DESC)) = 1