Querying History Version Data of a Delta Table
Syntax
Query the state of a Delta table at a specific point in time:
SELECT * FROM [database_name.]table_name
TIMESTAMP AS OF timestamp_expression
Query the state of a Delta table at a specific historical version:
SELECT * FROM [database_name.]table_name VERSION AS OF version_code
Parameter Description
Parameter |
Description |
---|---|
database_name |
Name of the database, consisting of letters, numbers, and underscores (_) |
table_name |
Name of the table in the database, consisting of letters, numbers, and underscores (_) |
timestamp_expression |
Timestamp, which cannot be later than the current time, formatted as yyyy-MM-ddTHH:mm:ss.SSS |
version_code |
Version number in the query result in Viewing History Operation Records of a Delta Table |
Example
SELECT * FROM delta_table0 TIMESTAMP AS OF '2020-10-18T22:15:12.013Z'; SELECT * FROM delta_table0 VERSION AS OF 2 where part_col='part_value';
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.