TD_HISTORY() table operator returns the snapshot history related to a datalake table.
Columns Returned
- id
- timestamp
Syntax
TD_SYSFNLIB.TD_HISTORY( ON ( <datalake_name>.<database_name>.<table_name> ) ) <alias_name> <datalake_name>::= Name of DATALAKE object <database_name>:: Name of database in data lake <table_name>:: Name of table <alias_name>:: Derived table alias name
Example: Iceberg
SEL * FROM TD_HISTORY(ON (iceberg_glue.db1.t1)) dt1;
*** Query completed. 2 rows found. 2 columns returned.
*** Total elapsed time was 2 seconds.
id timestamp
-------------------- -------------------
6384359091304721162 2024-09-03 19:11:58
Example: Delta Lake
SEL * FROM TD_HISTORY(ON (deltalake_unity.db1.t1)) dt1;
*** Query completed. 2 rows found. 2 columns returned.
*** Total elapsed time was 2 seconds.
id timestamp
-------------------- -------------------
0 2024-02-15 20:29:32
1 2024-02-15 20:30:27