Skip to content

Instantly share code, notes, and snippets.

@lgavish
Last active June 18, 2021 12:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save lgavish/9852cc850295e24e70c79c2eab0ea22c to your computer and use it in GitHub Desktop.
Save lgavish/9852cc850295e24e70c79c2eab0ea22c to your computer and use it in GitHub Desktop.
Extracting table metadata from Snowflake
SELECT
TABLE_CATALOG,
TABLE_SCHEMA,
TABLE_NAME,
TABLE_OWNER,
TABLE_TYPE,
IS_TRANSIENT,
RETENTION_TIME,
AUTO_CLUSTERING_ON,
COMMENT
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