-- Hook Creator Label table for storing hook creator label data from RDS
-- This table is populated by the Glue job rds_to_s3_hook_creator_label_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_creator_label_table_name} CLUSTER BY (p_date, p_hour) (
    -- Primary identifier
    ID VARCHAR(255),                                    -- Unique hook creator label identifier
    
    -- Timestamps
    CREATED_AT TIMESTAMP_TZ(9),                         -- When the label was created
    UPDATED_AT TIMESTAMP_TZ(9),                         -- Last update timestamp
    TIMESTAMP TIMESTAMP_TZ(9),                          -- Timestamp of the labeling event
    
    -- Label details
    LABEL TEXT,                                         -- The label/tag applied to the creator
    
    -- References
    HOOK_CREATOR_USER_ID INTEGER,                       -- User ID of the hook creator being labeled
    USER_ID_LABELED_BY INTEGER,                         -- User ID of who applied the label
    
    -- Partitioning columns for optimization
    P_DATE DATE,                                        -- Partition date based on created_at
    P_HOUR NUMBER(38,0)                                 -- Partition hour (0-23) based on created_at
);

