I have a query like below where i look at status of my table execution status. Where i need to search for last 7 days of executions status and for next day based on current date. I want my date filter to be dynamic based on current date. Currently i am using a static filter. But looking to do this dynamically. Any suggestions. I tried with CURRENT_TIMESTAMP function but format what i am looking is different because i need to filter very specifically for 7am for dates filter always
SELECT
SCHEDULED_TIME,
QUERY_START_TIME,
COMPLETED_TIME,
initcap(STATE) as STATE,
QUERYnumber,
FROM
table(
TASK_HISTORY(
task_name => 'TASK_1',
scheduled_time_range_start => TO_TIMESTAMP_LTZ('2024-07-26T07:00:00.000Z', 'AUTO'),
scheduled_time_range_end => TO_TIMESTAMP_LTZ('2024-08-02T07:00:00.000Z', 'AUTO'),
result_limit => 10000
)
)
ORDER BY
SCHEDULED_TIME