Turn Back Time using Fabric Warehouse Time Travel
Explore past data effortlessly, ensure accurate audits, and enhance decision-making.
⚠️ The Warehouse Time Travel feature was on preview at the date of this article, I will try to update if anything changes as best as I can.
Keeping multiple versions of historical data can be expensive and tricky. It can make it harder to ensure your data stays accurate and can also slow down your queries significantly.
Managing and using data effectively is more crucial than ever. One of the latest features in Microsoft Fabric is the Fabric Time Travel Warehouse, a component of Microsoft Fabric’s Data Warehouse solution. Let’s dive into why this feature is so important, how to use it effectively, and some real-world scenarios where it can make a big difference.
What is Fabric Time Travel Warehouse?
Imagine being able to go back in time and see what your data looked like at any specific moment in the past. That’s exactly what the Fabric Time Travel Warehouse lets you do. This feature allows you to access historical versions of your data, making it easier to recover lost information, conduct audits, and perform in-depth analyses.
Key Features
- Point-in-Time Querying: You can query your data as it existed at any specific point in time. This is incredibly useful for troubleshooting issues, auditing changes, and understanding historical trends.
- Data Recovery: If you accidentally delete or corrupt data, you can restore it to a previous state, ensuring you don’t lose valuable information.
- Compliance and Auditing: Many regulations require companies to keep historical data. This feature makes it easy to access past data for compliance checks and audits.
Why is Fabric Time Travel Important?
Enhanced Data Analysis
Analyzing historical data helps businesses understand past trends and make better decisions for the future but with time travel capabilities, analysts can compare data from different periods, spot trends, and uncover patterns that might otherwise be missed.
Improved Data Governance
Good data governance means keeping your data accurate, secure, and accessible, and with the ability to track changes and view historical data, you can ensure transparency and accountability in your projects. This is especially important in industries with strict regulatory requirements.
Disaster Recovery
Data loss can be devastating. Whether due to human error or technical failures, being able to restore data to its previous state quickly can save businesses time and money.
Using the Fabric Time Travel Warehouse in Microsoft Fabric
Let's consider a Warehouse with this data and get the timestamp of the data at this moment.
Currently, we have this Total Sales value if we execute this query.
SELECT SUM([TotalValue]) as TotalSales
FROM [WH_Car_Sales].[dbo].[Sales]
Now let´s add a few more registers to the table Sales.
INSERT INTO Sales (SaleID, SaleDate, SalespersonID, CarID, CustomerID, Quantity, TotalValue) VALUES
(11, '2023-08-20', 2, 1, 2, 1, 120000.00),
(12, '2023-08-25', 3, 2, 3, 1, 110000.00),
(13, '2023-09-01', 1, 3, 1, 1, 350000.00),
(14, '2023-09-05', 2, 2, 2, 1, 110000.00),
(15, '2023-09-10', 3, 1, 3, 1, 120000.00),
(16, '2023-09-15', 1, 2, 2, 1, 110000.00),
(17, '2023-09-20', 2, 3, 3, 1, 350000.00),
(18, '2023-09-25', 3, 1, 1, 1, 120000.00),
(19, '2023-09-30', 1, 2, 3, 1, 110000.00),
(20, '2023-10-01', 2, 3, 1, 1, 350000.00);
Now the Total Sales value is different of course.
If we want to see how was our data at a time before we could use the time travel function for that. We use the OPTION label at the end of the query and search for a specific TIMESTAMP on our warehouse system, like below.
With this, we get the data that I had on this table at the specific time of ‘2024–08–01T15:00:00.00’
SELECT SUM([TotalValue]) as TotalSales
FROM [WH_Car_Sales].[dbo].[Sales] as s
OPTION (FOR TIMESTAMP AS OF '2024-08-01T15:00:00.00');
This is possible without storing multiple versions of the data because these tables are delta parquet with stored temporal data, as you can see on the delta log folder if you are using Onelake.
Restore Fabric Warehouse
With this technology, you also have the option to restore your Warehouse to a specific point in time, these are created every 8 hours, or you can create your own.
Restore Data in a Table
You can also restore data in a table to a specific point in time.
At this moment I believe the only way to do that is to select the table at the specific time you want and create a new table over that, then delete the older one.
As this is a preview feature yet, I hope we get some command to update the table immediately according to the timestamp data.
Real-World Use Cases of Fabric Time Travel Warehouse
Financial Auditing
In finance, maintaining accurate historical records is essential for auditing and compliance and with Fabric Time Travel Warehouse, auditors can easily access financial data from any point in time, ensuring transparency and accuracy in all transactions.
Retail Inventory Management
Retail businesses need to analyze historical sales and inventory data to optimize their supply chains. With Fabric Time Travel Warehouse, retailers can compare inventory levels and sales performance across different periods, helping them make informed decisions and improve efficiency.
Conclusion
The Fabric Time Travel Warehouse is a powerful tool that brings new capabilities to data management allowing users to query past data, recover lost information, and meet compliance requirements, opening up new possibilities for data analysis and governance.
As data continues to grow in importance, tools like Fabric Time Travel Warehouse will be essential for helping businesses make informed decisions.
Did you enjoy it? For just $5 a month, become a Medium Member and enjoy limitless access to every masterpiece on Medium. By reading my posts as a Medium Member, you not only contribute to my work but also play a crucial role in enhancing the quality of my work. Your support means the world! 😊