feat: add logic to skip empty array columns when no columns or --skip-add-source-columns#327
Open
LuigiCerone wants to merge 1 commit intoz3z1ma:mainfrom
Open
feat: add logic to skip empty array columns when no columns or --skip-add-source-columns#327LuigiCerone wants to merge 1 commit intoz3z1ma:mainfrom
LuigiCerone wants to merge 1 commit intoz3z1ma:mainfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
_sync_doc_sectioninsync_operations.pyalways wrote thecolumnskey unconditionally:When a node has no columns (e.g. a source with
--skip-add-source-columnsenabled),incoming_columnsis[]and the result iscolumns: []being written to every source table osmosis touches — even though the user explicitly opted out of column management.The two behaviors were fully decoupled:
--skip-add-source-columnsprevented osmosis from querying the database for columns, but the empty list was still written unconditionally by_sync_doc_sectionregardless.Fix
Only write the
columnskey when there are actual columns to document; remove it otherwise:This is safe — dbt treats a missing
columnskey andcolumns: []identically.Tests
Two unit tests added to
test_sync_operations.py, using lightweight mocks (no DuckDB fixture needed):test_sync_doc_section_no_columns_key_not_addedcolumnsis never added when the node has no columnstest_sync_doc_section_existing_empty_columns_removedcolumns: []is cleaned up on the next run