QuerySpec: choose the returned fields #6

Merged
Gilles merged 1 commit from feat/5-queryspec-fields into master 2026-10-29 22:00:36 +00:00
Owner

Closes #5

Needed by Argus's metric charts (argus/backend#46, argus/frontend#30): a line chart needs two columns, a QuerySpec without group_by returned every registered field.

Changes

  • QuerySpec.fields (optional): columns returned, in that order, when there's no group_by; each one checked against the model's fields whitelist; refused with group_by / aggregates. Absent: unchanged behaviour (all registered fields).
  • README (QuerySpec section); tests in test_spec.py / test_engine.py.

Checks

pytest (58 passed), pylint 10/10, autopep8, bandit.

A release (minor) is needed afterwards for argus/backend to depend on it.

🤖 Generated with Claude Code

https://claude.ai/code/session_014BSmBtGWeFBD9z4mYm9SjA

Closes #5 Needed by Argus's metric charts (argus/backend#46, argus/frontend#30): a line chart needs two columns, a QuerySpec without `group_by` returned every registered field. ## Changes - `QuerySpec.fields` (optional): columns returned, in that order, when there's no `group_by`; each one checked against the model's `fields` whitelist; refused with `group_by` / `aggregates`. Absent: unchanged behaviour (all registered fields). - README (QuerySpec section); tests in `test_spec.py` / `test_engine.py`. ## Checks pytest (58 passed), pylint 10/10, autopep8, bandit. A release (minor) is needed afterwards for argus/backend to depend on it. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_014BSmBtGWeFBD9z4mYm9SjA
feature: QuerySpec "fields", the columns to return
All checks were successful
ci / test (3.13) (pull_request) Successful in 32s
ci / test (3.11) (pull_request) Successful in 30s
ci / test (3.12) (pull_request) Successful in 32s
ci / test (3.14) (pull_request) Successful in 35s
ci / test (3.15) (pull_request) Successful in 36s
ci / lint (pull_request) Successful in 55s
ci / publish (pull_request) Has been skipped
2226191fe3
Without group_by, a QuerySpec returned every registered field; a line
chart only needs two (date, value). Optional "fields" picks the
returned columns and their order -- each must be whitelisted, and it
can't be combined with group_by/aggregates, which already define the
columns.

Closes #5

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014BSmBtGWeFBD9z4mYm9SjA
Author
Owner
<!-- argus-link-bot:Gilles/bigb-django --> 📊 [Rapports Argus pour cette PR](https://reports.stationmyr.net/Gilles/bigb-django/pr/6)
Gilles merged commit a4199213ca into master 2026-10-29 22:00:36 +00:00
Gilles deleted branch feat/5-queryspec-fields 2026-10-29 22:00:36 +00:00
Gilles referenced this pull request from a commit 2026-10-29 22:56:37 +00:00
Sign in to join this conversation.
No description provided.