Skip to main content

official project PyPI version License

Databao Context Engine

Semantic context for your LLMs — generated automatically.
No more copying schemas. No manual documentation. Just accurate answers.

Website • Quickstart • Docs • Discord


What is Databao Context Engine?

Databao Context Engine is a Python library that automatically generates governed semantic context from your databases, BI tools, documents, and spreadsheets.

Use it with any LLM to deliver accurate, context-aware answers — without copying schemas or writing documentation by hand.

You can add Databao Context Engine as a standard Python dependency in your code or via Databao CLI (coming soon).

Your data sources → Context Engine → Unified semantic graph → Any LLM

Why choose Databao Context Engine?

Feature What it means for you
Auto-generated context Extracts schemas, relationships, and semantics automatically
Runs locally Your data never leaves your environment
MCP integration Works with Claude Desktop, Cursor, and any MCP-compatible tool
Multiple sources Databases, dbt projects, spreadsheets, documents
Built-in benchmarks Measure and improve context quality over time
LLM agnostic OpenAI, Anthropic, Ollama, Gemini — use any model
Governed & versioned Track, version, and share context across your team
Dynamic or static Serve context via MCP server or export as artifact

Installation

Databao Context Engine is available on PyPI and can be installed with uv, pip, or another package manager.

Using uv

uv add databao-context-engine

Using pip

pip install databao-context-engine

Supported data sources

  • Athena
  • BigQuery
  • ClickHouse
  • DuckDB
  • MSSQL
  • MySQL
  • PostgreSQL
  • Snowflake
  • SQLite
  • dbt projects
  • PDF files
  • Markdown and text files

Supported LLMs

Provider Configuration
Ollama languageModel: OLLAMA: runs locally, free

Quickstart

1. Create a domain

# Initialize the domain in a temporary directory
from databao_context_engine import init_dce_domain
from pathlib import Path
import tempfile

domain_manager = init_dce_domain(Path(tempfile.mkdtemp()))

# Or use an existing project
from databao_context_engine import DatabaoContextDomainManager

domain_manager = DatabaoContextDomainManager(domain_dir=Path("domain_dir"))

2. Configure data sources

from databao_context_engine import (
    CheckDatasourceConnectionResult,
    DatasourceConnectionStatus,
    DatasourceId,
    DatasourceType,
)

# Create a new datasource
postgres_datasource_id = domain_manager.create_datasource_config(
    DatasourceType(full_type="postgres"),
    datasource_name="my_postgres_datasource",
    config_content={
        "connection": {"host": "localhost", "user": "dev", "password": "pass"}
    },
).datasource.id

# Check the connection to the datasource is valid
check_result: dict[DatasourceId, CheckDatasourceConnectionResult] = domain_manager.check_datasource_connection()

assert len(check_result) == 1
assert check_result[postgres_datasource_id].connection_status == DatasourceConnectionStatus.VALID

3. Build context

build_result = domain_manager.build_context()

assert len(build_result) == 1
assert build_result[0].datasource_id == postgres_datasource_id
assert build_result[0].datasource_type == DatasourceType(full_type="postgres")
assert build_result[0].context_file_path.is_file()

4. Use the built contexts

Create a context engine

# Switch to the engine if you're already using a domain_manager
context_engine = domain_manager.get_engine_for_domain()

# Or directly create a context engine from the path to your DCE domaint
from databao_context_engine import DatabaoContextEngine

context_engine = DatabaoContextEngine(domain_dir=Path("path/to/project"))

Get all built contexts

# Switch to the engine to use the context built
all_built_contexts = context_engine.get_all_contexts()
assert len(all_built_contexts) == 1
assert all_built_contexts[0].datasource_id == postgres_datasource_id

print(all_built_contexts[0].context)

Search in built contexts

# Run a vector similarity search
results = context_engine.search_context("my search query")

print(f"Found {len(results)} results for query")
print(
    "\n\n".join(
        [f"{str(result.datasource_id)}\n{result.context_result}" for result in results]
    )
)

Contributing

We’d love your help! Here’s how to get involved:

  • ⭐ Star this repo — it helps others find us!
  • 🐛 Found a bug? Open an issue
  • 💡 Have an idea? We’re all ears — create a feature request
  • 👍 Upvote issues you care about — helps us prioritize
  • 🔧 Submit a PR
  • 📝 Improve docs — typos, examples, tutorials — everything helps!

New to open source? No worries! We're friendly and happy to help you get started. 🌱

For more details, see CONTRIBUTING.

📄 License

Apache 2.0 — use it however you want. See the LICENSE file for details.


Like Databao Context Engine? Give us a ⭐ — it means a lot!

Website • Docs • Discord

Metadata

Release files for databao-context-engine 0.7.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for databao-context-engine 0.7.2
File Size Uploaded Provenance
databao_context_engine-0.7.2.tar.gz 132.0 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for databao-context-engine 0.7.2
File Interpreter ABI Platform
databao_context_engine-0.7.2-py3-none-any.whl Python 3 none any Details

Total release size: 342.9 kB

Release files / databao_context_engine-0.7.2.tar.gz

Download URL databao_context_engine-0.7.2.tar.gz
Size 132.0 kB
Tags Source
SHA-256 checksum
How to use checksums
363a422c2b479fe1b63cc5e5e01b324bba0e19dff3e2ca99dfec2e4834199e5e
BLAKE2b-256 checksum
How to use checksums
0c1f6822b625bbd0737d2fbad5951613dd6a44dc1cf2820aba185c947173349f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.9.7

Release files / databao_context_engine-0.7.2-py3-none-any.whl

Download URL databao_context_engine-0.7.2-py3-none-any.whl
Size 210.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6554bf8d02e29da29699daf1358f53292c9c3c6c3e1cdbeb8c284a672b4c6e39
BLAKE2b-256 checksum
How to use checksums
fea8d9916ebbdadcb53c70cbf69f80af209e0f6ca086f4ce3a0c26c7d6056043
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.9.7

Security for databao-context-engine 0.7.2

Provenance

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page