Time Travel in Fabric Warehouse – Query Historical Data with T-SQL | Microsoft Fabric Tutorial

Time Travel in Fabric Warehouse – Query Historical Data with T-SQL | Microsoft Fabric Tutorial

Time Travel in Fabric Warehouse – Query Historical Data with T-SQL

Microsoft Fabric's Time Travel feature allows you to query past versions of your data warehouse tables using T-SQL. It’s a powerful capability for historical analysis, reproducibility, and data recovery.

๐Ÿ•’ What is Time Travel?

  • Query data as it existed at a specific point in time
  • Retention up to 30 days
  • Uses the FOR TIMESTAMP AS OF clause in SELECT statements
  • Read-only – no updates, deletes, or inserts allowed

✅ Syntax Example

SELECT * 
FROM dbo.dimension_customer
OPTION (FOR TIMESTAMP AS OF '2024-03-13T19:39:35.280');

๐Ÿ“Œ Use this to get current UTC timestamp in correct format:

SELECT CONVERT(varchar, SYSUTCDATETIME(), 126) AS TruncatedUTC;

๐Ÿ” Use Cases for Time Travel

  • ๐Ÿ“ˆ Historical trend analysis and reporting
  • ๐Ÿงช Machine learning model reproducibility
  • ๐Ÿ” Root cause investigations and debugging
  • ๐Ÿ”„ Safe verification during ETL pipeline development
  • ✅ Compliance and audit traceability

๐Ÿ” Permissions

  • Roles: Admin, Member, Contributor, Viewer
  • Security enforced: RLS, CLS, and DDM apply even in time travel

⚠️ Limitations

  • Only SELECT statements are supported
  • Not supported inside views or CTAS queries
  • Only UTC timestamps are allowed (no local timezones)
  • Supports up to 3-digit millisecond precision
  • Not usable on Lakehouse endpoints or Power BI datasets directly

๐ŸŽฌ Watch the Full Tutorial

Blog post written with the help of ChatGPT.