{%- set incremental_predicate = partition_filter_daily('DBT_INTERNAL_DEST.p_date') -%}
{{
    config(
        materialized='incremental',
        incremental_strategy='delete+insert',
        incremental_predicates=[incremental_predicate],
        unique_key=['user_id', 'platform', 'p_date'],
        snowflake_warehouse='FACT_PLAY_BACKFILL_SMALL',
        cluster_by=['p_date']
    )
}}

-- Filter spine to only include active user-platform-days
SELECT *
FROM {{ ref('agg_user_hook_platform_daily_spine') }}
WHERE is_active = TRUE
  AND {{ partition_filter_daily('p_date') }}
