Skip to main content Switch to mobile version bondi 0.4.3 A Python toolkit for document database research
pip install bondi Copy PIP instructions
BONDI provides reusable components for students and researchers working with document databases:
Native queries: describe MongoDB find, aggregation and CRUD command queries, Couchbase SQL++ and PostgreSQL reads.
Query execution: run individual queries or workloads, with optional concurrency.
Explain and profiling: inspect plans and extract common execution metrics.
Workload persistence: save and reload queries with their pattern IDs.
Schema inspection: explore nested fields, types, missingness and observed values.
Selectivity estimation: estimate MongoDB filter cardinality using fresh or persisted samples.
Workload generation: generate MongoDB find patterns with multiple instances and optional selectivity constraints.
The examples below use synchronous APIs, which work in scripts and notebooks. Execution and summary parsing support MongoDB, Couchbase and PostgreSQL. Estimation and workload generation currently target MongoDB.
Documentation · Quickstart · API reference
Requires Python 3.11+. In a uv project:
uv add bondi Or use pip install bondi. To execute Couchbase queries, install the optional extra: uv add 'bondi[couchbase]' or pip install 'bondi[couchbase]'.
For PostgreSQL, install bondi[postgresql] with uv or pip, then follow the PostgreSQL walkthrough.
For notebooks and demo data, get the source from a GitHub release. The installation guide explains both paths. Database examples below assume the local MongoDB demo is initialized on port 27017; later snippets reuse earlier variables.
Install BONDI guidance for Codex, Claude Code, Gemini CLI or Cursor from your project:
npx skills add relaxed-constraints/bondi --skill bondi The skill explains API and CLI choices and links to documentation and tutorials as you work. See agent skill installation for agent selection, local installation and a manual fallback. It does not install the Python library.
Describe operations without opening a connection. MongoDB filters and pipelines stay native, Couchbase queries use SQL++ text and parameters, and PostgreSQL queries use positional SQL bindings.
from bondi.mongodb import MongoCollectionRef, MongoFindQuery from bondi.couchbase import CouchbaseQuery business = MongoCollectionRef("demo", "business") query = MongoFindQuery(business, {"city": "Sydney"}, limit=5) sql = CouchbaseQuery( "SELECT RAW b FROM `demo`.`_default`.`business` b WHERE b.city = $city", named_parameters={"city": "Sydney"}, ) MongoDB queries · Couchbase queries
Executors consume all rows and optionally retain them. Workload methods use the same interface with configurable concurrency and error handling.
from bondi import MongoConnection from bondi.mongodb import MongoExecutor with MongoExecutor.from_connection(MongoConnection("mongodb://127.0.0.1:27017")) as executor: result = executor.run(query, collect_results=True) print(result.documents) print(result.row_count, result.elapsed_ms) Execution guide
Use explain() for a plan and profile() for execution diagnostics. Parse the raw response explicitly; unavailable summary metrics remain None.
Group queries into an ordered, single-backend workload. JSONL persistence restores concrete query objects, BSON filter values and optional pattern IDs.
from bondi.workload import Workload, WorkloadEntry workload = Workload([WorkloadEntry(query, pattern_id=0)]) workload.save("workload.jsonl") restored = Workload.load("workload.jsonl") Queries and workloads
Inspect Python dictionaries from any supported database or a file, without a database connection. Retain distinct values when you want to generate queries later.
from bondi.schema import Schema schema = Schema.from_documents( [{"city": "Sydney", "stars": 4}, {"city": "Melbourne"}], values="distinct", ) print(schema["stars"].missing_count) # 1 print(schema["city"].types["str"].values) Schema inspection
Estimate filter matches using MongoDB's own semantics, before skip and limit. A persisted sample is reused across estimates and removed when its context closes.
Generate distinct flat-find patterns whose instances vary filter values. Supply a prepared estimator to enforce sample-based selectivity bounds on each instance.
from bondi.mongodb import MongoGenerationConfig, MongoWorkloadGenerator generator = MongoWorkloadGenerator( collection=business, schema=schema, config=MongoGenerationConfig(min_predicates=1, max_predicates=2), ) workload = generator.generate(num_patterns=10, instances_per_pattern=50, seed=42) print(len(workload)) # 500 Generation guide · End-to-end tutorial
BONDI is maintained by Relaxed Constraints and distributed under the MIT license. For development, see Contributing. Report problems or suggest improvements through GitHub issues.
Use load_demo_data, load_file, load_documents, load_hf_dataset or load_hf_repository from bondi.data to insert data into MongoDB, Couchbase and PostgreSQL. CLI commands are bondi dataset load-demo, load-file, load-hf and load-hf-repository. See the dataset guide and demo notebook. All file-format and Hugging Face readers are included in a plain BONDI installation.
Author: Relaxed Constraints
Both files in this release have provenance metadata.
MIT View SPDX License List
Development Status 3 - Alpha
Intended Audience Science/Research
Programming Language Python :: 3
Release files for bondi 0.4.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
Built distribution (wheel)
Total release size: 634.7 kB
Release files / bondi-0.4.3.tar.gz
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Dec 2, 2026.
Release files / bondi-0.4.3-py3-none-any.whl
Both files in this release have been uploaded with provenance metadata.
With provenance bondi-0.4.3.tar.gz Dec 2, 2026
With provenance bondi-0.4.3-py3-none-any.whl Dec 2, 2026
Attestation for bondi-0.4.3.tar.gz
Attestation for bondi-0.4.3-py3-none-any.whl
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.
Release history Release notifications | RSS feed
Dec 2, 2026 2 release files Full provenance
Nov 26, 2026 2 release files Full provenance
Nov 22, 2026 2 release files Full provenance
Nov 20, 2026 2 release files Full provenance
Nov 16, 2026 2 release files Full provenance
Nov 15, 2026 2 release files Full provenance
Nov 14, 2026 2 release files Full provenance
Nov 13, 2026 2 release files Full provenance
Nov 12, 2026 2 release files Full provenance
Nov 10, 2026 2 release files Full provenance
Nov 9, 2026 2 release files Full provenance
Nov 7, 2026 2 release files Full provenance
Nov 5, 2026 2 release files Full provenance
Nov 3, 2026 2 release files Full provenance
Oct 30, 2026 2 release files Full provenance
Oct 28, 2026 2 release files Full provenance
Oct 27, 2026 2 release files Full provenance
"PyPI", "Python Package Index", and the blocks logos are registered trademarks of the Python Software Foundation.
© 2026 Python Software Foundation




