Skip to content
This repository was archived by the owner on Sep 2, 2025. It is now read-only.

Commit 995ebcb

Browse files
jtcohen6mikealfare
andauthored
Fix null column index issue during dbt docs generate for external tables (#1085) (#1257)
* coalesce column metadata columns with a value to avoid null errors for external tables in docs generate Co-authored-by: Mike Alfare <[email protected]>
1 parent 526eefa commit 995ebcb

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
kind: Fixes
2+
body: Fix null column index issue during `dbt docs generate` for external tables
3+
time: 2024-02-01T14:53:23.434624-05:00
4+
custom:
5+
Author: mikealfare
6+
Issue: "1079"

dbt/include/bigquery/macros/catalog/catalog.sql

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -121,10 +121,12 @@
121121
end as table_name,
122122
tables.table_type,
123123
tables.table_comment,
124-
columns.column_name,
125-
columns.column_index,
126-
columns.column_type,
127-
columns.column_comment,
124+
-- coalesce column metadata fields to ensure they are non-null for catalog generation
125+
-- external table columns are not present in COLUMN_FIELD_PATHS
126+
coalesce(columns.column_name, '<unknown>') as column_name,
127+
coalesce(columns.column_index, 1) as column_index,
128+
coalesce(columns.column_type, '<unknown>') as column_type,
129+
coalesce(columns.column_comment, '') as column_comment,
128130

129131
'Shard count' as `stats__date_shards__label`,
130132
table_stats.shard_count as `stats__date_shards__value`,

0 commit comments

Comments
 (0)