How do you handle versioning and rollback of data in Snowflake? What strategies can you use to recover data if you need to revert to a previous state?
💡 Model Answer
Snowflake provides built‑in time‑travel and fail‑safe features that allow you to query historical data and recover from accidental changes. Time‑travel keeps a copy of each table for a configurable retention period (default 1 day, up to 90 days). You can use the AT or BEFORE clauses to query a table as it existed at a past timestamp, or use the RESTORE command to revert a table to a previous state. For more granular versioning, you can implement a data lake approach: write each load to a new partitioned table (e.g., table_20240601) and maintain a manifest that records the version. When a rollback is needed, you can drop the latest table and rename the previous one. Another strategy is to use Snowflake Streams and Tasks to capture changes (CDC) and replay them if necessary. For large datasets, consider using external tables backed by S3 and versioned objects (e.g., using Delta Lake or Iceberg). Combining these techniques gives you both point‑in‑time recovery and the ability to roll back entire batches efficiently.
This answer was generated by AI for study purposes. Use it as a starting point — personalize it with your own experience.
🎤 Get questions like this answered in real-time
Assisting AI listens to your interview, captures questions live, and gives you instant AI-powered answers — invisible to screen sharing.
Get Assisting AI — Starts at ₹500