Skip to content

src/dazzle_back/runtime/predicate_compiler.py

Generated: 2026-03-30T04:38:47.763741+00:00

Commit: 615f1354a103

Language: python

Scope: dazzle_back

Purpose

Predicate compiler — translates ScopePredicate trees into parameterised SQL.

The compiled SQL is a WHERE fragment (no leading WHERE keyword). Parameters are returned as a plain list; positional %s placeholders are used throughout so the result is compatible with any DB-API 2.0 driver.

Two mar...

Key Exports

  • UserAttrRef
  • CurrentUserRef
  • compile_predicate

Dependencies

Imports

  • dataclasses.dataclass
  • typing.Any
  • dazzle.core.ir.fk_graph.FKEdge
  • dazzle.core.ir.fk_graph.FKGraph
  • dazzle.core.ir.predicates.BoolComposite
  • dazzle.core.ir.predicates.BoolOp
  • dazzle.core.ir.predicates.ColumnCheck
  • dazzle.core.ir.predicates.CompOp
  • dazzle.core.ir.predicates.Contradiction
  • dazzle.core.ir.predicates.ExistsCheck
  • dazzle.core.ir.predicates.PathCheck
  • dazzle.core.ir.predicates.ScopePredicate
  • dazzle.core.ir.predicates.Tautology
  • dazzle.core.ir.predicates.UserAttrCheck
  • dazzle.core.ir.predicates.ValueRef
  • dazzle_back.runtime.query_builder.quote_identifier

Event Interactions

None detected.

Invariants and Assumptions

  • Validates: PathCheck.path must have at least 2 segments, got {path!r}
  • Assert: len(predicate.children) == 1
  • Validates: Unknown predicate type: {type(predicate)!r}

Tests

  • tests/unit/test_predicate_compiler.py
  • tests/integration/test_runtime_e2e.py
  • tests/integration/test_runtime_pipeline.py
  • tests/unit/test_runtime_test_routes.py
  • tests/unit/test_runtime_services.py

Notes

This page was automatically generated by tools/gen_reference_docs.py.