-- Insert backend auth event data from BK_NONREALTIME_EVENT table
-- This query filters AuthCheck events from the non-realtime events
INSERT INTO {bk_auth_event_table_name}(
    NAME,
    TIMESTAMP,
    SOURCE,
    USER_ID,
    SESSION_ID,
    PROPERTIES,
    P_DATE,
    P_HOUR
)
SELECT
    NAME,
    TIMESTAMP,
    SOURCE,
    USER_ID,
    SESSION_ID,
    PROPERTIES,
    P_DATE,
    P_HOUR
FROM BK_NONREALTIME_EVENT
WHERE p_date = '{partition_date}'::DATE 
  AND p_hour = {partition_hour} 
  AND name = 'AuthCheck';
