-- Hook Reaction table for storing hook reaction data from RDS
-- This table is populated by the Glue job rds_to_s3_hook_reaction_hourly_upsert
-- 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 {hook_reaction_table_name} CLUSTER BY (p_date, p_hour) (
    -- Primary identifier
    ID NUMBER(38,0),                                    -- Unique hook reaction identifier
    
    -- Timestamps
    UPDATED_AT TIMESTAMP_TZ(9),                         -- Last update timestamp
    
    -- Reaction details
    REACTION_TYPE TEXT,                                 -- Type of reaction (like, love, fire, etc.)
    
    -- References
    HOOK_ID VARCHAR(255),                               -- Associated hook identifier
    USER_ID INTEGER,                                    -- User who created the reaction
    
    -- 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
);

