Repository navigation
fix(output): union columns across all rows for CSV and table rendering - #29
Open
arthi-arumugam-git wants to merge 1 commit into
Open
arthi-arumugam-git wants to merge 1 commit into
arthi-arumugam-git wants to merge 1 commit into
Conversation
Columns came from rows[0].keys() only. CSV output crashed with ValueError when a later row carried a field the first row did not (DictWriter's default extrasaction), and table output silently dropped that column. Both now use a first-seen-order union of keys across all rows; CSV renders missing fields as empty via restval. Diagnosis is orvionx's in Allium-Science#19; fixes Allium-Science#19.
arthi-arumugam-git
force-pushed
the
fix-heterogeneous-rows
branch
from
August 18, 2026 06:22
87c8e82 to
0d3efa7
Compare
This branch has not been deployed
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.
Fixes #19; the diagnosis is orvionx's.
Two failure modes from
rows[0].keys():DictWriter's defaultextrasactionraisesValueErrorthe moment a later row carries a field the first row does not, which is routine for responses with optional, chain-specific fields.Both paths now use a first-seen-order union of keys across all rows; CSV renders missing fields as empty strings via
restval. Column order for homogeneous responses is unchanged.Tests in
tests/test_output_columns.py: heterogeneous rows produce all columns without raising, extra-field values reach the output, missing fields render empty, and homogeneous ordering is untouched. 4 pass with the fix; the module has no_union_columnson main so they demonstrate the gap there.