-- Insert auth user data from RDS to Snowflake
-- This query inserts new records from S3 stage

INSERT INTO {auth_user_table_name}(
    ID,
    USERNAME,
    DATE_JOINED,
    IS_STAFF,
    P_DATE,
    P_HOUR,
    EMAIL
)	
SELECT 
    $1:id as id,
    $1:username as username,
    $1:date_joined as date_joined,
    $1:is_staff as is_staff,
    '{partition_start_date}' as p_date,
    {partition_start_hour} as p_hour,
    $1:email as email
FROM {stage_path} (file_format => 'BASIC_PARQUET_LOADER', pattern => ('.*.parquet'));

