Skip to content

OSSS.ai.agents.data_query.queryspec

OSSS.ai.agents.data_query.queryspec

Projection dataclass

A single projected column.

  • collection: which collection/table this comes from
  • field: the actual field/column name
  • alias: optional alias to expose to the UI / downstream consumers

Join dataclass

Declarative join between two collections.

Example: consents.person_id -> persons.id

  • from_collection / from_field: the FK side
  • to_collection / to_field: the PK/target side
  • alias: optional alias for the joined entity
  • select_fields: fields to pull from the joined collection
  • computed_name_alias: if set, downstream code can use select_fields (e.g. first_name + last_name) to build a single UI-friendly name column with this alias.

FilterCondition dataclass

A simple filter you can later translate to query params or SQL. Example: last_name startswith 'R'

QuerySpec dataclass

Declarative description of a query over a base collection.

Generated defaults
  • projections: default columns to show
  • joins: FK-based joins (e.g. consents.person_id -> persons.id)
  • synonyms: NL → field paths (merged from schema.py)
  • search_fields: good candidates for UI search boxes
  • sort: ordered list of (field, direction) pairs

with_filter(field, op, value)

Small helper to add a filter fluently.

with_sort(field, direction='asc')

Small helper to add a sort clause fluently.

direction: "asc" or "desc" (case-insensitive)