Julian Eccleshall
Julian Eccleshall

Reputation: 554

snowflake Time travel data is not available

I accidently recreated a table on snowflake (LICENCE_TEST), when I try to flashback the table using accountadmin/superuser role

CREATE  TABLE LICENCE_TEST2
CLONE LICENCE_TEST before (TIMESTAMP => to_timestamp_ntz('2021-07-01 11:03:00'))

I received error message:

Time travel data is not available for table LICENCE_TEST. The requested time is either beyond the allowed time travel period or before the object creation time.

from the TABLE_STORAGE_METRICS, it clearly shows the table data is still available and is it no a transit table enter image description here

Does anyone know why?

thanks

Upvotes: 1

Views: 1950

Answers (2)

user2842685
user2842685

Reputation: 324

I'm aware this is an older question, but it pops up when searching for this error so I'll just chime in: also make sure that Snowflake correctly processes your timestamp. I had a similar issue, but it turned out it was wrongly swapping around my day and month value.

Upvotes: 0

Simon D
Simon D

Reputation: 6229

Looks like you dropped and re-created the table. If you want to get the table back you need to UNDROP it first. You'll need to rename the current LICENCE_TEST table to something else so that the table can be brought back. From this part of the documentation:

If an object with the same name already exists, UNDROP fails. You must rename the existing object, which then enables you to restore the previous version of the object.

Try something like:

alter table LICENSE_TEST rename to LICENSE_TEST_1;
UNDROP TABLE LICENSE_TEST;

You can keep renaming / undropping like this until the timetravel retention period is over I think.

Upvotes: 1

Related Questions