-- Backend authentication events
-- Clustered by partition date, hour, and event name for optimal query performance
CREATE TRANSIENT TABLE IF NOT EXISTS {bk_auth_event_table_name} CLUSTER BY (p_date, p_hour, name)(
	-- Event details
	NAME VARCHAR(255) COMMENT 'Event name/type',
	TIMESTAMP TIMESTAMP_TZ(9) COMMENT 'Event timestamp',
	SOURCE VARCHAR(255) COMMENT 'Event source system',
	
	-- User information
	USER_ID NUMBER(38,0) COMMENT 'User identifier',
	SESSION_ID VARCHAR(255) COMMENT 'Session identifier',
	
	-- Event data
	PROPERTIES VARIANT COMMENT 'Event properties in JSON format',
	
	-- Partitioning columns
	P_DATE DATE COMMENT 'Partition date for table optimization',
	P_HOUR NUMBER(38,0) COMMENT 'Partition hour for table optimization'
) COMMENT='Table contains backend authentication events';

