Repository navigation
feat(scope): add --format csv to query/query-multi - #26
Merged
Merged
Conversation
4 of 5 tasks
CSV output lets query results feed pandas.read_csv() directly without a JSON parsing round-trip. Columns are the union of all row keys, sorted alphabetically with Timestamp pinned first for determinism across heterogeneous rows (e.g. stats/timechart by group). query-multi requires --union true since comparison mode isn't row-shaped. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Parquet preserves native bool/float64/string types and true nulls for missing columns, unlike CSV which must stringify everything. Column type per field is inferred from non-nil values (bool/float64/ string), falling back to a stringified UTF8 column on any mix so the writer never errors on unexpected value shapes. Also fix CSV output to write bools as "True"/"False" instead of Go's lowercase "true"/"false" -- pandas.read_csv's C parser only recognizes the capitalized form as boolean, otherwise the column comes back as object dtype. Adds github.com/parquet-go/parquet-go as a new dependency. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
rylero
force-pushed
the
worktree-cached-spinning-raccoon
branch
from
July 6, 2026 07:07
444decf to
78d1db8
Compare
…python client SKILL.md hadn't been updated for #27 (claudescope-py) or #28 (--follow/search-fields), and this branch adds --format csv/parquet on top -- the agent-facing guide was missing all four. Documents: - search-fields command - --format csv/parquet output for query/query-multi --union true - query --follow true live streaming (NDJSON, incompatible with --format/--out) - the claudescope-py Python client, recommended over --format for Python consumers since it builds a DataFrame directly Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Found via end-to-end testing against a real .wpilog and pandas
(not just Go-side round-trip tests): rowsToParquet wrote rows via
GenericWriter's map/reflect path (w.Write([]map[string]any{...})),
whose isNullValue check (parquet-go's column_buffer_reflect.go)
treats any Go zero value -- false, 0.0, "" -- as equivalent to an
absent key for Optional columns. A real Enabled=false or a sensor
reading of exactly 0.0 was silently coming back as a Parquet null
(NaN/None in pandas), which is a correctness bug that would corrupt
real telemetry data on release.
Fix: build parquet.Row values manually with explicit definition
levels (1 = present, 0 = null) via schema.Lookup for each column's
index, bypassing the reflect path entirely. Verified against real
pandas: false/0.0/"" now round-trip as themselves, while genuinely
missing columns (e.g. an unmatched lookup join) still round-trip as
null. Added a regression test.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
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.
Summary
--format csvtoqueryandquery-multi(union mode) so results can go straight intopandas.read_csv()instead of round-tripping through JSON.Timestamppinned first, so heterogeneous rows (e.g.stats/timechart ... by group) still produce a stable, complete header.query-multi --format csvrequires--union true; comparison mode's per-session shape isn't row-shaped and errors out with a clear message instead.helpcommand's schema/notes to document the new flag.Test plan
go build ./...go test ./...query, heterogeneous-column CSV padding, unsupported--formaterror,query-multi --format csvwithout--union trueerror🤖 Generated with Claude Code