1. Lära sig
  2. /
  3. Courses
  4. /
  5. Snowflake Architecture

Connected

exercise

Querying historical data with Time Travel

Snowy Peak's overnight batch job loaded 2 cancelled accounts into the subscriptions table. The data team wants to compare the current row count with what it was just before the batch ran. Snowflake's Time Travel makes this possible without any external backup.

The snowy_peak.subscriptions table has columns subscription_id, user_email, plan, status, start_date, and monthly_fee. The session variable $snapshot_ts holds the timestamp captured just before the batch update ran.

Instruktioner

100 XP
  • Use AT (TIMESTAMP => ...) to query snowy_peak.subscriptions as it was before the batch update. Use the session variable $snapshot_ts as the timestamp.
  • Count the rows as pre_update_count to confirm how many subscriptions existed before the 2 cancelled accounts were added.
Powered by Snowflake