- Categories:
System functions (System Information)
SYSTEM$GET_TABLE_ARCHIVE_METADATA¶
Returns metadata about the archived data for a table, without requiring data retrieval from the archive tier.
Syntax¶
Arguments¶
'table_name'The name of the table with archived data. The table must have had data archived to the COOL or COLD tier, usually by a storage lifecycle policy.
Returns¶
Returns a TEXT value containing JSON with metadata about the archived data. The JSON structure includes:
rowCount: The number of rows in the archive.columns: An object containing metadata for each column:column_id: The column ID (as shown in the COLUMNS view).data_type: Column data typemin: The minimum value for the column, ornullif not applicable.max: The maximum value for the column, ornullif not applicable.
Note
The min and max values are null for TEXT, OBJECT, ARRAY, and VARIANT data types.
The output also includes the archived timestamp column (METADATA$STORAGE_LIFECYCLE_POLICY_ARCHIVED_TIMESTAMP),
which indicates when each row was archived.
Example output:
Usage notes¶
The table owner or an account administrator (a user with the ACCOUNTADMIN role) who has access to the table can execute this function.
Use this function to inspect archived data metadata without incurring the cost of retrieving data from the archive tier.
The
column_idfield helps distinguish columns when a column has been dropped and a new column with the same name has been added later.To retrieve the actual archived data, use the CREATE TABLE … FROM ARCHIVE OF command.
Examples¶
Retrieve metadata about archived data for a table:
Parse the JSON output to extract specific information: