Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix null column index issue during dbt docs generate for external tables #1085

Merged
merged 2 commits into from
Feb 1, 2024

Conversation

mikealfare
Copy link
Contributor

resolves #1079

Problem

External tables don't show up in COLUMN_FIELD_PATHS metadata. When generating the catalog, these columns were returning null values for external tables. dbt docs generate does not account for null values for these fields, in particular for the column index.

Solution

Coalesce the queried values with default values:

  • column_name: '<unknown>'
  • column_index: 1
  • column_type: '<unknown>'
  • column_comment: ''

The '<unknown>' values align with the previous implementation, as does the 1. In the previous implementation, this was implicit, as it was calculated as a row_number across null fields. In this implementation, it's explicitly 1, as there is really only one field, "the data". The column comment in the original implementation was null in this scenario; this is an attempt to avoid such an error with this field in the future.

Checklist

  • I have read the contributing guide and understand what's expected of me
  • I have run this code in development and it appears to resolve the stated issue
  • This PR includes tests, or tests are not required/relevant for this PR
  • This PR has no interface changes (e.g. macros, cli, logs, json artifacts, config files, adapter interface, etc) or this PR has already received feedback and approval from Product or DX

@mikealfare mikealfare self-assigned this Feb 1, 2024
@mikealfare mikealfare requested a review from a team as a code owner February 1, 2024 20:00
@cla-bot cla-bot bot added the cla:yes label Feb 1, 2024
@mikealfare mikealfare merged commit a32e149 into 1.7.latest Feb 1, 2024
32 checks passed
@mikealfare mikealfare deleted the bug/1079 branch February 1, 2024 20:31
jtcohen6 pushed a commit that referenced this pull request Jun 12, 2024
…ables (#1085)

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

* changelog
mikealfare added a commit that referenced this pull request Jun 12, 2024
…ables (#1085) (#1257)

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

Co-authored-by: Mike Alfare <13974384+mikealfare@users.noreply.github.com>
github-actions bot pushed a commit that referenced this pull request Jun 12, 2024
…ables (#1085) (#1257)

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

Co-authored-by: Mike Alfare <13974384+mikealfare@users.noreply.github.com>
(cherry picked from commit 995ebcb)
mikealfare pushed a commit that referenced this pull request Jun 12, 2024
…ables (#1085) (#1257) (#1258)

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

Co-authored-by: Mike Alfare <13974384+mikealfare@users.noreply.github.com>
(cherry picked from commit 995ebcb)

Co-authored-by: Jeremy Cohen <jeremy@dbtlabs.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants