diff --git a/warehouse/dbt/models/intermediate/users/int_artifacts_by_address.sql b/warehouse/dbt/models/intermediate/users/int_artifacts_by_address.sql new file mode 100644 index 000000000..9914bc379 --- /dev/null +++ b/warehouse/dbt/models/intermediate/users/int_artifacts_by_address.sql @@ -0,0 +1,12 @@ +with addresses as ( + select distinct + UPPER(chain_name) as artifact_namespace, + LOWER(address) as artifact_name + from {{ ref('int_first_time_addresses') }} +) + +select + {{ oso_id("artifact_namespace", "artifact_name") }} as artifact_id, + artifact_namespace, + artifact_name +from addresses diff --git a/warehouse/dbt/models/staging/ethereum/stg_ethereum__potential_bots.sql b/warehouse/dbt/models/staging/ethereum/stg_ethereum__potential_bots.sql deleted file mode 100644 index e8c654185..000000000 --- a/warehouse/dbt/models/staging/ethereum/stg_ethereum__potential_bots.sql +++ /dev/null @@ -1,13 +0,0 @@ -{{ config( - enabled=target.name == 'production', - materialized='table', - partition_by={ - "field": "min_block_time", - "data_type": "timestamp", - "granularity": "day", - }, -) }} - -{{ - potential_bots("ethereum") -}} diff --git a/warehouse/dbt/models/staging/optimism/stg_optimism__first_time_addresses.sql b/warehouse/dbt/models/staging/optimism/stg_optimism__first_time_addresses.sql index 81fe8f781..d1ad414c0 100644 --- a/warehouse/dbt/models/staging/optimism/stg_optimism__first_time_addresses.sql +++ b/warehouse/dbt/models/staging/optimism/stg_optimism__first_time_addresses.sql @@ -11,4 +11,12 @@ incremental_strategy="insert_overwrite" ) }} + +{% set unique_key_col = config.get('unique_id') %} + {{ first_time_addresses("optimism") }} + +{% if is_incremental() %} + where + {{ unique_key_col }} not in (select {{ unique_key_col }} from {{ this }}) +{% endif %}