-- Auth User table for storing authentication user data from RDS
-- This table is populated by the Glue job rds_to_s3_auth_user_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 {auth_user_table_name} CLUSTER BY (p_date, p_hour) (
    -- Primary identifier
    ID NUMBER(38,0) COMMENT 'User ID (integer)',
    
    -- User authentication
    USERNAME VARCHAR(16777216) COMMENT 'User email or phone number (depending on signup method)',
    
    -- User metadata
    DATE_JOINED VARCHAR(255) COMMENT 'User joined *timestamp* (not date) in UTC',
    
    -- Partitioning columns for optimization
    P_DATE VARCHAR(255) COMMENT 'User join date',
    P_HOUR NUMBER(38,0) COMMENT 'User join hour',
    
    -- Contact information
    EMAIL VARCHAR(255) COMMENT 'User email (if user signed up via email)',
    IS_STAFF BOOLEAN COMMENT 'Whether user is part of Suno staff. Includes some advisors'
);

