Created
June 24, 2021 20:22
-
-
Save markrittman/4b2f2423a904c9655de6b2c6d8528df2 to your computer and use it in GitHub Desktop.
List all datasets with partitioned tables, broken-down by partitioning type
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT | |
TABLE_SCHEMA, | |
count(distinct table_name) as table_count, | |
CASE | |
WHEN IS_SYSTEM_DEFINED = 'YES' THEN 'Ingestion-Time' | |
WHEN data_type = 'TIMESTAMP' THEN concat('Time-unit column') | |
WHEN data_type = 'INT64' THEN concat('Integer Range') | |
END | |
AS partitioning_type | |
FROM | |
region-eu.INFORMATION_SCHEMA.COLUMNS | |
WHERE | |
IS_PARTITIONING_COLUMN = 'YES' | |
GROUP BY | |
1,3 | |
order by 3 desc |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment