Skip to content

API Reference parrot_tools.querysource.dialect

github-actions[bot] edited this page Dec 2, 2026 · 4 revisions

parrot_tools.querysource.dialect

View source

QuerySource conditions dialect: static reference, validators and payload builder (spec §3 M3).

Verified against querysource 4.5.11 (GitHub tag 4.5.11 == dev): parsers/abstract.pyx:156-290,380-410,474-527 and parsers/sql.pyx:25,96,113-235. The wheel ships compiled parsers, so this module is the source of truth for the LLM — never introspect the parser at runtime.

Attribute DIALECT_REFERENCE

Attribute DIALECT_VERIFIED_AGAINST

Type: str

Attribute DICT_OPERATORS

Type: tuple[str, ...]

Alias DialectReference

Re-exported from parrot_tools.querysource.models.DialectReference.

Alias FilterValue

Re-exported from parrot_tools.querysource.models.FilterValue.

Alias InvalidConditionsError

Re-exported from parrot_tools.querysource.errors.InvalidConditionsError.

Attribute JSONB_OPERATORS

Type: tuple[str, ...]

Attribute KEY_SUFFIX_CHARS

Type: str

Attribute LIST_OPERATORS

Type: tuple[str, ...]

Attribute OPTION_KEYS

Type: frozenset[str]

Function build_conditions

Assemble the QS conditions payload deterministically; forced wins (query_slug.py:143 precedence).

build_conditions(*, placeholders: dict[str, Any] | None, filter: dict[str, FilterValue] | None, fields: list[str] | None, ordering: list[str] | None, grouping: list[str] | None, limit: int | None, offset: int | None, refresh: bool, max_rows: int, forced: dict[str, Any] | None) -> dict[str, Any]

Parameter Type Default Description
placeholders dict[str, Any] | None
filter dict[str, FilterValue] | None
fields list[str] | None
ordering list[str] | None
grouping list[str] | None
limit int | None
offset int | None
refresh bool
max_rows int
forced dict[str, Any] | None

Returns: dict[str, Any]

Function check_version_compatibility

Return a warning when installed major.minor differs from DIALECT_VERIFIED_AGAINST (S11).

check_version_compatibility(installed: str) -> str | None

Parameter Type Default Description
installed str

Returns: str | None

Function load_variables

Return {'@name': doc} for the deployment's variable functions (services.py:29-33,94-96); never raises.

load_variables() -> dict[str, str]

Returns: dict[str, str]

Attribute logger

Function reject_variable_values

Raise InvalidConditionsError when any scalar value in conditions starts with '@'.

FEAT-558 deployment variables (@today …) are resolved by the deploying app and are not portable on the linked-surface wire (FEAT-598 spec Non-Goals, AC3). Relative dates must use the closed UDF keyword vocabulary instead (TODAY, YESTERDAY, FDOM, LDOM, CURRENT_YEAR, CURRENT_MONTH, LAST_YEAR).

reject_variable_values(conditions: Mapping[str, Any]) -> None

Parameter Type Default Description
conditions Mapping[str, Any]

Function validate_filter

Validate WHERE entries against the grammar; return rejected keys (raise when strict).

validate_filter(filter: dict[str, FilterValue], *, strict: bool = True) -> list[str]

Parameter Type Default Description
filter dict[str, FilterValue]
strict bool True

Returns: list[str]

Function validate_placeholders

Raise InvalidConditionsError for keys not in allowed or present in OPTION_KEYS.

validate_placeholders(placeholders: dict[str, Any], allowed: set[str]) -> None

Parameter Type Default Description
placeholders dict[str, Any]
allowed set[str]

Architecture

Clients

Bots & Agents

Memory

Knowledge

Tools & Toolkits

Flows

Experts

Skills

Stores & Loaders

MCP & A2A

Server & APIs

Integrations

Outputs & A2UI

Prompts

Security

Operations

Migration

SDD Tooling

LLM Wiki

Deployment

Decisions

API Reference

Clone this wiki locally