Skip to content

feat(dump): optional fields param to download a column subset - #37

Merged
luccasmmg merged 1 commit into
mainfrom
feat/dump-columns
Nov 6, 2026
Merged

luccasmmg merged 1 commit into
mainfrom
feat/dump-columns

Conversation

@luccasmmg

Copy link
Copy Markdown
Member

Why

The NESO data explorer lets users hide columns, and they expect the download to leave those columns out. The whole-table dump (GET /dump/{resource_id}) could only export every column. The only other route was /dump/query, which runs a fresh SQL export just to drop columns.

What

  • GET /datastore/api/v2/dump/{resource_id} takes an optional fields param, given as a,b,c or as a JSON array. It is parsed the same way as fields on datastore_search.
  • Only those columns are exported, in the order given. Every row is still included, sorted by _id.
  • An unknown column name returns a 400 before any BigQuery job runs. A malformed fields value also returns a 400.
  • Each column subset is cached and cleaned up under its own prefix, dumps/<rid>/fields-<hash>/<fmt>/<rev>/. It never serves or deletes the whole-table file and is still covered by the existing dumps/ lifecycle rule.
  • Parquet subsets always use an explicit column list. Without this, the SELECT * shortcut would bring back every column.
  • File names get a _selected_columns suffix.
  • If fields is left out or empty, the endpoint behaves exactly as before.
  • API.md is updated.

Tests

  • New endpoint tests cover parsing, the filename suffix, the default path and malformed input.
  • New engine tests check that only the requested columns are selected, with no WHERE and with ORDER BY _id. They also check the separate cache/sweep prefix, the CSV header and that an unknown field is rejected before export.
  • pytest: 679 passed. ruff check passes. mypy reports no new errors.

GET /dump/{resource_id}?fields=a,b (or a JSON array) exports only those
columns, in the given order, for every row. Unknown names are a 400.
Each column subset is cached and GC-swept under its own
dumps/<rid>/fields-<hash>/<fmt>/ prefix, so it never serves or deletes
the whole-table file. Parquet subsets always use an explicit column list
instead of SELECT *. Downloads get a _selected_columns filename suffix.
@coderabbitai

coderabbitai Bot commented Nov 6, 2026

Copy link
Copy Markdown

Important

  • Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 19f0061e-18e2-404c-a0a6-fab1b0aa2515
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

Share

@luccasmmg
luccasmmg merged commit d06eaf3 into main Nov 6, 2026
2 checks passed
luccasmmg added a commit that referenced this pull request Nov 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant