-- Video Hook Metadata table for storing video hook metadata from RDS
-- This table is populated by the Glue job rds_to_s3_video_hook_metadata_hourly_insert
-- 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 {video_hook_metadata_table_name} CLUSTER BY (p_date, p_hour) (
    -- Primary identifier
    ID VARCHAR(255),                                    -- Unique video hook metadata identifier
    
    -- Timestamps
    CREATED_AT TIMESTAMP_TZ(9),                         -- When the metadata record was created
    UPDATED_AT TIMESTAMP_TZ(9),                         -- Last update timestamp
    
    -- Metadata content
    RENDER_SCHEMA VARIANT,                              -- Rendering schema configuration (JSON)
    
    -- Video reference
    VIDEO_HOOK_ID VARCHAR(255),                         -- Associated video hook identifier
    
    -- 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
);

