-
Notifications
You must be signed in to change notification settings - Fork 113
/
bigquery_info_columns.sql
42 lines (39 loc) · 1.06 KB
/
bigquery_info_columns.sql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
--
-- Author: Hari Sekhon
-- Date: 2020-09-16 08:41:30 +0100 (Wed, 16 Sep 2020)
--
-- vim:ts=4:sts=4:sw=4:et:filetype=sql
--
-- https://github.com/HariSekhon/SQL-scripts
--
-- License: see accompanying Hari Sekhon LICENSE file
--
-- If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback to help steer this or other code I publish
--
-- https://www.linkedin.com/in/HariSekhon
--
-- BigQuery Information Schema
--
-- Lists columns and their details in a given dataset
--
-- Processes 10MB of data when run
-- https://cloud.google.com/bigquery/docs/tables#columns_view
SELECT
table_catalog,
table_schema,
table_name,
column_name,
ordinal_position,
is_nullable,
data_type,
is_generated,
generation_expression,
is_stored,
is_hidden,
is_updatable,
is_system_defined,
is_partitioning_column,
clustering_ordinal_position
FROM
-- XXX: replace bigquery-public-data.github_repos with myproject.mydataset
`bigquery-public-data.github_repos.INFORMATION_SCHEMA.COLUMNS`;