- Categories:
GET_ TABLE_ VERSIONS¶
Returns one row for each data snapshot that Snowflake has indexed for an Apache Iceberg™ table.
Use this function to find the snapshot that you want to query, or to create a version tag on. To query a snapshot, pass its snapshot ID to the AT clause. For more information, see Time Travel for Apache Iceberg™ tables.
Syntax¶
Arguments¶
'table_name'The name of the Iceberg table whose version history you want to retrieve. The table name is a string, so it must be enclosed in single quotes. If the table name is fully qualified, such as
'<db>.<schema>.<table_name>', enclose the entire name in single quotes.
Output¶
The function returns the following columns:
| Column name | Data type | Description |
|---|---|---|
| VERSION_ID | NUMBER | The Iceberg snapshot ID. Pass this value to AT(VERSION => ...) to query the snapshot. |
| VERSION_CREATED_AT | TEXT | The time when the snapshot was committed. |
| QUERY_ID | TEXT | The ID of the query that produced the snapshot. For tables that use automated refresh, this column is a string of zeros. |
Usage notes¶
-
The argument must be a literal string. You can’t pass a column or an expression.
-
The output contains only data-changing snapshots that Snowflake still has indexed. Snapshots that have left the retained history don’t appear. Operations that update table metadata without writing data, such as adding a column or creating a version tag, don’t produce a snapshot and don’t appear in the output.
Examples¶
List the snapshots available for an Iceberg table named my_iceberg_table:
Output:
Query the table as it was in the earlier snapshot: