Snowflake Time Travel

Leveraging Query History:

SELECT 
    query_id,
    query_text,
    user_name,
    query_type,
    start_time
FROM TABLE(frostbyte_tasty_bytes.information_schema.query_history())
WHERE 1=1
    AND query_type = 'UPDATE'
    AND query_text LIKE '%frostbyte_tasty_bytes.raw_pos.truck_dev%'
ORDER BY start_time DESC;

Setting a SQL Variable:

SET query_id = 
(
    SELECT TOP 1 query_id
    FROM TABLE(frostbyte_tasty_bytes.information_schema.query_history())
    WHERE 1=1
        AND query_type = 'UPDATE'
        AND query_text LIKE '%SET truck_age = (YEAR(CURRENT_DATE()) / t.year);'
    ORDER BY start_time DESC
);

Leveraging Time-Travel to Revert our Table

CREATE OR REPLACE TABLE frostbyte_tasty_bytes.raw_pos.truck_dev
    AS 
SELECT * FROM frostbyte_tasty_bytes.raw_pos.truck_dev
BEFORE(STATEMENT => $query_id); 

AT: The AT keyword specifies that the request is inclusive of any changes made by a statement or transaction with timestamp equal to the specified parameter.

BEFORE: The BEFORE keyword specifies that the request refers to a point immediately preceding the specified parameter.

TIMESTAMP: Specifies an exact date and time to use for Time Travel.

OFFSET: Specifies the difference in seconds from the current time to use for Time Travel.

STATEMENT: Specifies the query ID of a statement to use as the reference point for Time Travel.