fix(dbt): tolerate non-dict column rows in import helpers - #2618
Conversation
_find_column, finalize column tests, and seed payload builders assumed columns were always dicts in a list. Skip bad rows so YAML drift cannot crash dbt→MDL conversion.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
Walkthroughdbt artifact conversion now validates model and column structures before processing them. New unit tests cover malformed entries, valid mixed inputs, dbt test metadata, primary-key derivation, and seed payload filtering. Changesdbt artifact conversion guards
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@core/wren/src/wren/dbt.py`:
- Around line 1294-1295: Normalize the model’s columns value before the
comprehension iterates it: in the columns-processing logic, retain the provided
value only when it is a list and use an empty list for all other values,
including truthy scalars such as integers. Preserve the existing dictionary and
non-null name filter.
- Around line 1152-1154: Update the column guard in the primary-key derivation
loop to also skip dictionaries whose "name" value is None, before any
column["name"] access. Preserve processing for dictionary columns with a
non-None name.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 4d4a1a0c-d3ba-4571-a61b-2e6fdb52910c
📒 Files selected for processing (2)
core/wren/src/wren/dbt.pycore/wren/tests/unit/test_dbt_column_guards.py
|
Thanks @coderabbitai — both points addressed in 0af74ff: the primary-key loop now skips columns whose |
|
Tip For best results, initiate chat on the files or code changes.
🐇 ✅ If you found this review helpful, would you consider giving us a shout-out on X? Thank you for using CodeRabbit! |
What failure does this repair?
_convert_dbt_artifactsraisedAttributeError: 'str' object has no attribute 'get'when a dbtmanifest.jsonmodel carried a non-listcolumnsvalue or a list containing non-dict rows (e.g. a bare string). Repro: import a dbt project whose model has"columns": ["id"]— the helper called.get()on the string and crashed the import.Summary
dbt import helpers crashed when
model.columnswas non-list or held non-dict rows._find_column,_finalize_column_tests, and_seed_model_payloadnow skip malformed model and column entries.Verification
Duplicate check
Searched open/closed PRs and existing dbt guard coverage; #2514 and #2549 harden the seed/query path but not these import helpers (
_find_column,_finalize_column_tests). No overlap with the row-shape guards added here.Summary by CodeRabbit
Bug Fixes
Tests