Power BI

Have you tried

for Microsoft Power BI

Snowflake is a leader in the new era of cloud data warehousing and analytics. It is a title well-earned as Snowflake provides intuitive, fast querying capabilities coupled with very economical storage and zero maintenance burden. It also hosts a myriad feature which makes life easier for customers. In this blog, we will discuss one such feature – Snowflake’s Time Travel using Tableau.

The Need

In most scenarios, your warehouse has data pertaining to multiple landscapes across many regions. You have everything on your plate to run the business but unfortunately, one of your systems uncovers a bug due to some unexpected failure. Most of the time your systems work great! But hey, unseen problems creep in as complexity grows. So now, you are left with inconsistency and getting back your good old data is at stake.

Recovering your data can be expensive thanks to traditional warehousing, but Snowflake’s modern BI Time Travel can get your data back in no-time without having to dig deep into your pockets. Time Travel is used to access historical data at any point within a defined time period. Its a lifesaver in cases where data related objects may have been intentionally or unintentionally deleted/modified that needs to be recovered.

Better Together: Tableau and Snowflake Time Travel

Things get a lot easier if you are a Tableau user. Simply put – Snowflake captures every change of an object in a snapshot. The snapshot(s) can be used for Time Travel. This can be leveraged using Tableau’s Custom SQL wherein you can query SQL script to access time historic data. Time Travel is supported by default for a period of 1 day in Standard edition and up-to 90 days in an Enterprise edition.

Note: You must have set Time Travel retention period > 0 in Snowflake to be able to leverage this functionality in Tableau’s Custom SQL

How does it work?

Time Travel comes in handy when creating ad-hoc reports. SQL statements having AT| BEFORE clause with select statements can be used to Time Travel. These clause query data exactly (AT) or preceding a specified point (BEFORE). Note that you need to mention timestamp or offset time in seconds.

After Connecting to Snowflake using Tableau, you can access the Custom SQL editor below the Connections panel.

Let’s go step by step –

1. Drag in any table to view its data. You can see it has 365 rows


Snowflake’s Sales Data table sample in Tableau


2. Make a change to the table in snowflake to modify it


Modifying dataset in Snowflake using Insert into query


3. Now refresh the source in Tableau to view the changed resultset. You can see the updated records having 366 rows.


Updated resultset after refreshing in Tableau


Let’s look at the data as well. Due to the newly inserted row, Apr 1 has Sales Amount 520.

4. Now, let’s write Custom SQL in Tableau to travel back in time – before the change was made to the table (in this case a few minutes ago)


Custom SQL editor in Tableau having AT clause


The above statement uses offset time in seconds. Note that query ID from snowflake can also be used to return the same result. We can use the ID of the insert statement in the BEFORE clause to Time Travel back to before we inserted a row as follows.


Custom SQL editor in Tableau having BEFORE clause


5. Now let’s use this Custom SQL as DataSource and view the resultset. You can see that the number of rows has changed back to 365


Time travelled data in Tableau


Let’s look at the data too. You can see that Apr 1 is restored having Sales amount value 120.leveraging-time-travel-feature-snowflake-using-tableau


Note: Your select query should use qualified names (“Warehouse”.”Schema”.”Table”) to be evaluated by Tableau’s SQL engine.

Bravo! You’ve now successfully mastered Time Travel using Tableau’s Custom SQL.


If you are new to the Snowflake and are unsure if it fits your budget, check out this post. Stay tuned for more on Tableau + Snowflake!

Subscribe to our Newsletter

5920 Windhaven Pkwy
Plano TX 75093.

+1 888-227-2794

+1 972-232-2233

+1 888-227-7192