DictionaryLeap

Guide

A BigQuery data dictionary from your schema

A BigQuery data dictionary lists each table and view, and each column on it: the name, the GoogleSQL data type, whether the column allows null, and any description already stored on the column. Nested fields inside a RECORD or STRUCT are listed too. The dictionary describes structure. It does not contain the rows stored in those columns.

DictionaryLeap does not connect to BigQuery. Run one of the read-only queries below, save the result as a CSV with the header row, and upload that file. The upload reads table_name, column_name, and data_type. table_schema and is_nullable are used when they are present. A description cell stays in the file so you can compare it with the draft. The upload does not copy that cell into the dictionary.

The free preview shows the first 25 columns and the first glossary domain. The Dataset Pack is $49 for one table of up to 200 columns, with a flat glossary plus one domain of the hierarchy, and a glossary CSV and SKOS for that domain. The Database Pack is $249 for up to 50 tables and 2,000 columns, with the full glossary and taxonomy hierarchy, all parent and child checks, an Excel glossary sheet, a glossary CSV, and SKOS. Each pack is a one-time price for that upload. It is not a subscription, and nothing renews.

What the dictionary covers

Dataset. In BigQuery the dataset is table_schema. A dataset-qualified query returns that dataset. A region-qualified query can see every dataset in the region that the caller can list, so the region query below filters to one dataset.

Table or view name, and the top-level column name. The COLUMNS page describes table_name as the table or view. COLUMN_FIELD_PATHS uses the same wording.

data_type, the GoogleSQL type. A repeated field is an ARRAY type. A RECORD or STRUCT column uses a STRUCT type. This query does not split length and precision into their own columns.

is_nullable from INFORMATION_SCHEMA.COLUMNS. The COLUMNS page says the value is YES or NO, depending on whether the column mode allows NULL. A nested field path has an empty is_nullable cell, because COLUMN_FIELD_PATHS has no is_nullable column.

description, from COLUMN_FIELD_PATHS. INFORMATION_SCHEMA.COLUMNS has no description column. The description is empty when none was stored.

What the CSV should contain

Use these header names. Letter case does not matter. A catalog file needs table_name, column_name, and data_type (or udt_name). The other columns are optional.

ColumnRequiredWhat it is
table_schemaNoDataset id. Keeps two tables with the same name apart.
table_nameYesTable or view name.
column_nameYesTop-level column name, or the field path for a nested field.
data_typeYesGoogleSQL type name. udt_name is accepted only when data_type is absent.
is_nullableNoYES or NO on a top-level column. Empty on a nested field path.
descriptionNoDescription stored on the column or field. The upload does not copy this cell. Keep it so you can compare it with the draft.

How to do it

  1. Pick the dataset. Use the dataset-qualified query, or the region-qualified query with table_schema set to that dataset. Set the query location to the dataset location.
  2. Run one query. Run a single statement. Both statements read INFORMATION_SCHEMA views only. They do not select rows from your tables.
  3. Save the CSV. Save the result as a CSV with the header row. The file includes top-level columns and nested field paths.
  4. Start the preview. Upload the file on the build page. Leave sample values off. DictionaryLeap does not connect to BigQuery.

Read-only SQL

Run one query. Save the result as a CSV with the header row. Do not include a dump of table rows.

One dataset

Replace my_project and my_dataset with your project id and dataset id. Project ids can contain a hyphen, so the example quotes the project id. If the dataset id contains a hyphen, quote it the same way: `my_project`.`my-dataset`.INFORMATION_SCHEMA.COLUMNS. INFORMATION_SCHEMA view names are case-sensitive.

Google's INFORMATION_SCHEMA introduction says a query against these views must include a dataset or a region qualifier, and that the query fails when the query location does not match that qualifier. Run this statement in the dataset's location.

The first SELECT is one row per top-level column from INFORMATION_SCHEMA.COLUMNS. The COLUMNS page says is_hidden is YES or NO depending on whether the column is a pseudo column such as _PARTITIONTIME or _PARTITIONDATE. This query keeps is_hidden = 'NO'. The description is joined from COLUMN_FIELD_PATHS where field_path equals the top-level column name. COLUMNS itself has no description column.

The second SELECT adds nested fields. COLUMN_FIELD_PATHS has one row for each top-level column and for each field nested in a RECORD or STRUCT. field_path is the top-level name, or a dotted path such as parent.child. Rows where field_path differs from column_name are the nested fields, including fields inside a repeated STRUCT. A repeated scalar stays on the first SELECT: its data_type is the ARRAY type, and its description comes from the matching field path.

Dataset qualifier

SELECT
  c.table_schema,
  c.table_name,
  c.column_name,
  c.data_type,
  c.is_nullable,
  paths.description
FROM `my_project`.my_dataset.INFORMATION_SCHEMA.COLUMNS AS c
LEFT JOIN `my_project`.my_dataset.INFORMATION_SCHEMA.COLUMN_FIELD_PATHS AS paths
  ON paths.table_catalog = c.table_catalog
 AND paths.table_schema = c.table_schema
 AND paths.table_name = c.table_name
 AND paths.column_name = c.column_name
 AND paths.field_path = c.column_name
WHERE c.is_hidden = 'NO'

UNION ALL

SELECT
  nested.table_schema,
  nested.table_name,
  nested.field_path AS column_name,
  nested.data_type,
  CAST(NULL AS STRING) AS is_nullable,
  nested.description
FROM `my_project`.my_dataset.INFORMATION_SCHEMA.COLUMN_FIELD_PATHS AS nested
WHERE nested.field_path <> nested.column_name
ORDER BY table_schema, table_name, column_name;

Save the result as one CSV with the header row. my_project and my_dataset are placeholders, not names on your project. The column name for a nested field is the field path.

One dataset in a region

Use this form when you qualify INFORMATION_SCHEMA by region instead of by dataset. Replace my_project, region-us, and my_dataset. region-us is the US multi-region qualifier from the BigQuery syntax pages. A dataset in another location uses that location's region qualifier, still backtick-quoted because the name contains a hyphen.

The same pages say a region-qualified view is project scope. The filter table_schema = 'my_dataset' keeps one dataset. The upload groups rows by table_schema and table_name. It does not group by project. The Database Pack stops at 50 tables and 2,000 columns, so leave the dataset filter in place unless the file is already inside that limit.

The COLUMNS and COLUMN_FIELD_PATHS pages list the permissions bigquery.tables.get and bigquery.tables.list. They say those permissions are included in roles/bigquery.admin, roles/bigquery.dataViewer, roles/bigquery.dataEditor, and roles/bigquery.metadataViewer. For a dataset qualifier you need permission on the dataset. For a region qualifier you need permission on the project.

Region qualifier

SELECT
  c.table_schema,
  c.table_name,
  c.column_name,
  c.data_type,
  c.is_nullable,
  paths.description
FROM `my_project`.`region-us`.INFORMATION_SCHEMA.COLUMNS AS c
LEFT JOIN `my_project`.`region-us`.INFORMATION_SCHEMA.COLUMN_FIELD_PATHS AS paths
  ON paths.table_catalog = c.table_catalog
 AND paths.table_schema = c.table_schema
 AND paths.table_name = c.table_name
 AND paths.column_name = c.column_name
 AND paths.field_path = c.column_name
WHERE c.table_schema = 'my_dataset'
  AND c.is_hidden = 'NO'

UNION ALL

SELECT
  nested.table_schema,
  nested.table_name,
  nested.field_path AS column_name,
  nested.data_type,
  CAST(NULL AS STRING) AS is_nullable,
  nested.description
FROM `my_project`.`region-us`.INFORMATION_SCHEMA.COLUMN_FIELD_PATHS AS nested
WHERE nested.table_schema = 'my_dataset'
  AND nested.field_path <> nested.column_name
ORDER BY table_schema, table_name, column_name;

Save the result as one CSV with the header row. Replace region-us when the dataset is not in the US multi-region.

These queries were checked against the current Google Cloud pages for INFORMATION_SCHEMA.COLUMNS and INFORMATION_SCHEMA.COLUMN_FIELD_PATHS. They were not run on a BigQuery project. COLUMNS has no description column. The description comes from COLUMN_FIELD_PATHS. The schema export guide does not include a BigQuery section.

Sensitivity flags and the glossary

Paid packs include Excel, Word, Markdown, and an editable dbt schema.yml. The free preview shows the first 25 columns on screen, with a watermark, and the first glossary domain. Exports stay off. DictionaryLeap picks the pack from the file. You do not choose a price.

The Dataset Pack glossary is a flat glossary plus one domain of the hierarchy, with a glossary CSV and SKOS for that domain. The Database Pack includes the full glossary and taxonomy hierarchy, all parent and child checks, an Excel glossary sheet, a glossary CSV, and SKOS. Definitions are drafts for a data owner to confirm.

DictionaryLeap flags potential sensitivity from the column name. The tag is potential. It is not legal advice, and these queries do not select row values, so the file has no sample of what the column stores.

Healthcare, Financial services, and Retail are optional industry presets on the upload form. A preset adds terms and sensitivity rules when column names match. Any other choice uses the General preset. The preset does not change the price.

The description column is the text already stored in BigQuery. The catalog upload does not copy that cell into the dictionary. Compare it with the draft after you download a pack. An empty description is fine. Names and types are enough to start.

Questions about a file or a charge: contact@logicalleap.io.

FAQ

Start the free preview

The free preview shows the first 25 columns and the first glossary domain. The Dataset Pack is $49 for one table of up to 200 columns, with a flat glossary plus one domain of the hierarchy, and a glossary CSV and SKOS for that domain. The Database Pack is $249 for up to 50 tables and 2,000 columns, with the full glossary and taxonomy hierarchy, all parent and child checks, an Excel glossary sheet, a glossary CSV, and SKOS. Each pack is a one-time price for that upload. It is not a subscription, and nothing renews.

Start the free preview