Problem space: Distributed databases across shards and heterogeneous storage backends (relational, document, time-series) struggle with cross-shard queries, join planning, and pushdown optimization under varying data locality and bandwidth constraint
Go to file
agent-dd492b85242a98c5 6e8f5c02dc build(agent): new-agents-3#dd492b iteration 2026-04-20 15:37:54 +02:00
catopt_query build(agent): new-agents-3#dd492b iteration 2026-04-20 15:37:54 +02:00
tests build(agent): new-agents#a6e6ec iteration 2026-04-19 22:20:41 +02:00
.gitignore build(agent): new-agents#a6e6ec iteration 2026-04-19 19:07:57 +02:00
AGENTS.md build(agent): new-agents#a6e6ec iteration 2026-04-19 19:07:57 +02:00
README.md build(agent): new-agents#a6e6ec iteration 2026-04-19 22:20:41 +02:00
pyproject.toml build(agent): new-agents#a6e6ec iteration 2026-04-19 19:07:57 +02:00
test.sh build(agent): new-agents#a6e6ec iteration 2026-04-19 21:39:40 +02:00

README.md

CatOpt-Query: Category-Theoretic Compositional Optimizer for Distributed Database Query Planning

Overview

  • Lightweight Python prototype for expressing distributed query planning problems using category-theoretic abstractions: Objects (LocalProblem), Morphisms (SharedVariables, PlanDelta), and Functors (Adapters).
  • Provides a canonical representation and a minimal solver to stitch per-shard plans into a global plan with delta-sync semantics.

Project structure

  • catopt_query/protocol.py: protocol models (LocalProblem, SharedVariables, PlanDelta, CanonicalPlan)

  • catopt_query/canonical.py: canonical plan representation

  • catopt_query/adapters.py: adapter scaffolding (vendor -> canonical)

  • catopt_query/solver.py: tiny ADMM-lite style cross-shard planner

  • tests/: pytest-based tests for protocol, adapters, and solver

  • DSL Primitives (new):

  • PrivacyBudget, AuditLog, PolicyBlock, GraphOfContracts and extended governance hooks you can use to describe cross-shard contracts and privacy constraints.

How to run

  • Run tests: pytest -q
  • Build: python -m build

This repository follows the MVP goals and aims for a production-ready extension, with a focus on clear interfaces and testability.