cancel
Showing results for 
Search instead for 
Did you mean: 

Snowflake query with time travel not working from Databricks while reading into Dataframe.

Skv
New Contributor II

I am trying to read the changes data from snowflake query into the dataframe using Databricks.

Same query is working in snowflake but not in Databricks. Both sides timezones and format are same for the timestamp. I am trying to implement changetracking feature from below query. No problem in snowflake but in databricks issue is coming.

Below is my query and error.

SELECT * FROM TestTable CHANGES(INFORMATION => DEFAULT) AT(TIMESTAMP => '2023-05-03 00:43:34.885 -7000')

Error:

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

Please help.

1 ACCEPTED SOLUTION

Accepted Solutions

karthik_p
Esteemed Contributor

@SkvAdi v​ based on error it looks time provided seems to in correct, provided time stamp might be before object created date time. can you please check when table created and provide and test

View solution in original post

2 REPLIES 2

karthik_p
Esteemed Contributor

@SkvAdi v​ based on error it looks time provided seems to in correct, provided time stamp might be before object created date time. can you please check when table created and provide and test

sher
Valued Contributor II

you are format is wrong that's why you got an error

try this

SELECT * FROM TestTable CHANGES(INFORMATION => DEFAULT)

AT(TIMESTAMP => TO_TIMESTAMP_TZ('2023-05-03 00:43:34.885','YYYY-MM-DD HH24:MI:SS.FF')) 

Welcome to Databricks Community: Lets learn, network and celebrate together

Join our fast-growing data practitioner and expert community of 80K+ members, ready to discover, help and collaborate together while making meaningful connections. 

Click here to register and join today! 

Engage in exciting technical discussions, join a group with your peers and meet our Featured Members.