Skip to content

Commit

Permalink
Fix duplicate rows in first time addresses (#1890)
Browse files Browse the repository at this point in the history
* add all

* update macro from first block timestamp to blockdate

---------

Co-authored-by: Carl Cervone <[email protected]>
  • Loading branch information
chuxinh and ccerv1 authored Aug 5, 2024
1 parent c2ce4fd commit 554f13a
Show file tree
Hide file tree
Showing 7 changed files with 43 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ with daily_gas_fees as (
,date_diff(c.date_timestamp, ft.first_active_day, DAY) as days_since_first_active
from {{ ref('stg_%s__first_time_addresses' % lower_network_name)}} as ft
join {{ ref('stg_utility__calendar')}} as c
on c.date_timestamp >= ft.first_block_timestamp
on c.date_timestamp >= ft.first_active_day
{% if is_incremental() %}
and c.date_timestamp < TIMESTAMP_SUB(_dbt_max_partition, INTERVAL 0 DAY)
{% else %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,11 @@
incremental_strategy="insert_overwrite"
)
}}

{% set unique_key_col = config.get('unique_id') %}

{{ first_time_addresses("base") }}
{% if is_incremental() %}
where
{{ unique_key_col }} not in (select {{ unique_key_col }} from {{ this }})
{% endif %}
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,11 @@
incremental_strategy="insert_overwrite"
)
}}

{% set unique_key_col = config.get('unique_id') %}

{{ first_time_addresses("frax") }}
{% if is_incremental() %}
where
{{ unique_key_col }} not in (select {{ unique_key_col }} from {{ this }})
{% endif %}
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,11 @@
incremental_strategy="insert_overwrite"
)
}}

{% set unique_key_col = config.get('unique_id') %}

{{ first_time_addresses("metal") }}
{% if is_incremental() %}
where
{{ unique_key_col }} not in (select {{ unique_key_col }} from {{ this }})
{% endif %}
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,11 @@
incremental_strategy="insert_overwrite"
)
}}

{% set unique_key_col = config.get('unique_id') %}

{{ first_time_addresses("mode") }}
{% if is_incremental() %}
where
{{ unique_key_col }} not in (select {{ unique_key_col }} from {{ this }})
{% endif %}
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,11 @@
incremental_strategy="insert_overwrite"
)
}}

{% set unique_key_col = config.get('unique_id') %}

{{ first_time_addresses("pgn") }}
{% if is_incremental() %}
where
{{ unique_key_col }} not in (select {{ unique_key_col }} from {{ this }})
{% endif %}
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,11 @@
incremental_strategy="insert_overwrite"
)
}}

{% set unique_key_col = config.get('unique_id') %}

{{ first_time_addresses("zora") }}
{% if is_incremental() %}
where
{{ unique_key_col }} not in (select {{ unique_key_col }} from {{ this }})
{% endif %}

0 comments on commit 554f13a

Please sign in to comment.