Skip to content

Commit

Permalink
Fix null column index issue during dbt docs generate for external t…
Browse files Browse the repository at this point in the history
…ables (#1085)

* coalesce column metadata columns with a value to avoid null errors for external tables in docs generate

* changelog
  • Loading branch information
mikealfare authored Feb 1, 2024
1 parent 374e403 commit a32e149
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
6 changes: 6 additions & 0 deletions .changes/unreleased/Fixes-20240201-145323.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
kind: Fixes
body: Fix null column index issue during `dbt docs generate` for external tables
time: 2024-02-01T14:53:23.434624-05:00
custom:
Author: mikealfare
Issue: "1079"
10 changes: 6 additions & 4 deletions dbt/include/bigquery/macros/catalog/catalog.sql
Original file line number Diff line number Diff line change
Expand Up @@ -121,10 +121,12 @@
end as table_name,
tables.table_type,
tables.table_comment,
columns.column_name,
columns.column_index,
columns.column_type,
columns.column_comment,
-- coalesce column metadata fields to ensure they are non-null for catalog generation
-- external table columns are not present in COLUMN_FIELD_PATHS
coalesce(columns.column_name, '<unknown>') as column_name,
coalesce(columns.column_index, 1) as column_index,
coalesce(columns.column_type, '<unknown>') as column_type,
coalesce(columns.column_comment, '') as column_comment,

'Shard count' as `stats__date_shards__label`,
table_stats.shard_count as `stats__date_shards__value`,
Expand Down

0 comments on commit a32e149

Please sign in to comment.