You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
queryme.compile_query() is a stub since v0.1.0 (raises NotImplementedError). v0.2.0 implements it so consuming services (ZabTruth first) can ship POST /api/v1/_query.
Compiler is self-contained — it builds a synthetic MetaData from the SchemaDescriptor rather than asking the service for its own metadata. Services just execute the resulting Select against their async engine and serialise rows. Decision rationale : QueryMe stays a pure library, no service-side wiring contract beyond the Select itself.
Acceptance criteria
compile_query(descriptor, schema) -> sqlalchemy.Select returns a working SELECT statement.
Synthetic MetaData built from SchemaDescriptor ; closed ColumnType mapped to SQLAlchemy types (String, Text, Integer, Float, Boolean, Uuid, DateTime, Date, JSON).
Supports : single FROM, multiple INNER JOINs, AND-joined WHERE, multiple ORDER BY, LIMIT, OFFSET.
All 9 WHERE operators implemented : =, !=, >, <, >=, <=, IN, LIKE, IS NULL.
Re-validates input via validate_against_schema ; on issues, raises CompilationError carrying the structured issues (no silent failure, no half-built statement).
Resolves both unqualified (col) and qualified (table.col) references in WHERE / ORDER / JOIN.
Tests cover : every operator, join (single + chained), order, limit/offset, qualified refs, error path with bad descriptor.
CI green : ruff clean, mypy strict clean, full pytest suite passes.
Out of scope
Mutation (INSERT/UPDATE/DELETE) — Phase 2.x per ADR 001.
Ambiguous unqualified column references (same name on multiple joined tables) — currently first-match, will tighten in v0.3 with a validator warning.
Type coercion of WHERE values vs column types — delegated to SQLAlchemy / database layer.
Definition of done
PR opened against main, CI green, maintainer reviews and squash-merges. Branch deletion + tag v0.2.0 are maintainer calls.
Context
queryme.compile_query()is a stub since v0.1.0 (raisesNotImplementedError). v0.2.0 implements it so consuming services (ZabTruth first) can shipPOST /api/v1/_query.Reference : ADR 001 §Phase 2 at
D:/Document/ZabLaboratory/docs/adr/001-blueprint-db-access.md(étage 1, hors git).Approach
Compiler is self-contained — it builds a synthetic
MetaDatafrom theSchemaDescriptorrather than asking the service for its own metadata. Services just execute the resultingSelectagainst their async engine and serialise rows. Decision rationale : QueryMe stays a pure library, no service-side wiring contract beyond theSelectitself.Acceptance criteria
compile_query(descriptor, schema) -> sqlalchemy.Selectreturns a working SELECT statement.MetaDatabuilt fromSchemaDescriptor; closedColumnTypemapped to SQLAlchemy types (String,Text,Integer,Float,Boolean,Uuid,DateTime,Date,JSON).=,!=,>,<,>=,<=,IN,LIKE,IS NULL.validate_against_schema; on issues, raisesCompilationErrorcarrying the structured issues (no silent failure, no half-built statement).col) and qualified (table.col) references in WHERE / ORDER / JOIN.Out of scope
INSERT/UPDATE/DELETE) — Phase 2.x per ADR 001.Definition of done
PR opened against
main, CI green, maintainer reviews and squash-merges. Branch deletion + tagv0.2.0are maintainer calls.