{%- 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', 'p_date'],
        snowflake_warehouse='FACT_PLAY_BACKFILL_SMALL',
        cluster_by=['p_date']
    )
}}

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