-- RDS_USER_PERSONA_REACTION table for storing user reactions to personas from RDS
-- This table is populated by the Glue job which dumps data from RDS to S3 
-- and then loads it into Snowflake
-- Clustered by partition date and hour for optimal query performance
CREATE TRANSIENT TABLE IF NOT EXISTS {user_persona_reaction_table_name} CLUSTER BY (p_date, p_hour) (
    -- Primary identifier
    ID NUMBER(38,0),                                    -- Unique user persona reaction identifier
    
    -- Timestamps
    UPDATED_AT TIMESTAMP_TZ(9),                         -- Last update timestamp
    
    -- Reaction details
    LOVED BOOLEAN,                                      -- Whether the user loved the persona
    USER_ID NUMBER(38,0),                               -- ID of the user
    PERSONA_ID VARCHAR(255),                            -- ID of the persona
    
    -- Partitioning columns for optimization
    P_DATE DATE,                                        -- Partition date based on updated_at
    P_HOUR NUMBER(38,0)                                 -- Partition hour (0-23) based on updated_at
);

