Skip to content

Instantly share code, notes, and snippets.

@lgavish
Created May 5, 2021 21:09
Show Gist options
  • Save lgavish/c4e79f114d113d3973e217c2d601e116 to your computer and use it in GitHub Desktop.
Save lgavish/c4e79f114d113d3973e217c2d601e116 to your computer and use it in GitHub Desktop.
Extracting table freshness and volume from Snowflake
SELECT
TABLE_CATALOG,
TABLE_SCHEMA,
TABLE_NAME,
ROW_COUNT,
BYTES,
CONVERT_TIMEZONE('UTC', CREATED) as CREATED,
CONVERT_TIMEZONE('UTC', LAST_ALTERED) as LAST_ALTERED
FROM "ANALYTICS".information_schema.tables
WHERE
table_schema NOT IN ('INFORMATION_SCHEMA')
AND TABLE_TYPE NOT IN ('VIEW', 'EXTERNAL TABLE')
ORDER BY TABLE_CATALOG, TABLE_SCHEMA, TABLE_NAME;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment