-- RDS_PERIOD_CREDIT_USAGE table
-- Populated by Glue job rds_to_s3_bots_periodcreditusage_hourly_insert
CREATE TRANSIENT TABLE {periodcreditusage_table_name} IF NOT EXISTS CLUSTER BY (p_date, p_hour) (
    ID VARCHAR(255),
    CREATED_AT TIMESTAMP_TZ(9),
    UPDATED_AT TIMESTAMP_TZ(9),
    PERIOD_ANCHOR TIMESTAMP_TZ(9),
    CREDITS_USED NUMBER(38,0),
    PERIOD_CREDIT_LIMIT NUMBER(38,0),
    EXTRA_CREDITS_BALANCE NUMBER(38,0),
    USER_ID NUMBER(38,0),
    PERIOD_END TIMESTAMP_TZ(9),
    STRIPE_SUBSCRIPTION_ID VARCHAR(255),
    PLAN_LEVEL NUMBER(38,0),
    EXTRA_CREDITS_USED NUMBER(38,0),
    USAGE_PLAN_ID VARCHAR(255),
    REVCAT_SUBSCRIPTION_ID VARCHAR(255),
    IS_ACTIVE BOOLEAN,
    PERIOD_EXTRA_CREDIT_LIMIT NUMBER(38,0),
    P_DATE DATE,
    P_HOUR NUMBER(38,0)
);
