Skip to main content

dosi-engine

Python bindings for osi-engine: load an OSI semantic model once, then list metrics/dimensions, compile metric queries to dialect SQL, and execute them against a warehouse — all in-process.

from dosi_engine import Engine, QueryError

engine = Engine(
    model_path="model.yaml",
    connections={"warehouse": {"type": "snowflake", "account": "...", "password": "..."}},
)

engine.metrics()                     # [{"name", "kind", "datasets", ...}]
engine.compile({"metrics": ["order_count"],
                "group_by": [{"field": "orders.status"}]},
               dialect="snowflake")  # {"dialect": "snowflake", "sql": "..."}
engine.execute({"metrics": ["order_count"]},
               connection="warehouse", timeout_secs=60)
#   {"dialect", "sql", "columns", "rows": [{col: val}], "row_count"}

The list/compile/execute payloads are the same machine contract as osi --format json and the REST API; errors raise ModelError / QueryError / ExecuteError (see dosi_engine.errors) carrying the same structured fields (code, candidates, hint) as the CLI/REST JSON error contract. QueryError.candidates lists valid alternatives for unknown/ambiguous names, so agentic callers can retry without parsing prose.

Semantics worth knowing

  • One Engine = one compiled model. Construction runs load → validate → compile and fails fast with ModelError. Engines are thread-safe; compile and execute release the GIL.
  • Connections are an in-memory name -> datasource settings mapping in the Datus agent.yml datasources: vocabulary. File discovery and loading belong to the Rust CLI/server; the Python binding never reads or writes a connections file.
  • execute without connection runs on the runtime connections mapping's default: true profile when one exists, else on local DuckDB (db_path= file, or in-memory).
  • Timeouts propagate cancellation to cooperative executors. Athena uses a bounded cleanup window and reports confirmation in execution_info. Other drivers may keep running after the caller's deadline. Successful Athena results and execution errors retain one diagnostic entry per query.
  • DuckDB runs in process and ships inside the wheel — nothing to install for local execution. Warehouse drivers are compiled in too (exec-all), so no client libraries either.

Building

Requires a Python ≥ 3.12 interpreter discoverable by pyo3; on hosts whose default python3 is older, set PYO3_PYTHON:

cd crates/dosi-py
PYO3_PYTHON=$(command -v python3.12) uvx maturin build --release -o ../../target/wheels

Development loop against a venv: uvx maturin develop (with the venv active). Rust-side tests: cargo test -p dosi-py; Python smoke tests (after maturin develop): pytest tests/python/.

Metadata

Release files for dosi-engine 0.2.2

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

Built distributions (wheels)

Table of built distributions (wheels) for dosi-engine 0.2.2
File Actions
dosi_engine-0.2.2-cp312-abi3-win_amd64.whl CPython 3.12 abi3 Windows x86-64 Details for dosi_engine-0.2.2-cp312-abi3-win_amd64.whl
dosi_engine-0.2.2-cp312-abi3-manylinux_2_28_x86_64.whl CPython 3.12 abi3 Linux glibc 2.28+ x86-64 Details for dosi_engine-0.2.2-cp312-abi3-manylinux_2_28_x86_64.whl
dosi_engine-0.2.2-cp312-abi3-manylinux_2_28_aarch64.whl CPython 3.12 abi3 Linux glibc 2.28+ ARM64 Details for dosi_engine-0.2.2-cp312-abi3-manylinux_2_28_aarch64.whl
dosi_engine-0.2.2-cp312-abi3-macosx_11_0_arm64.whl CPython 3.12 abi3 macOS 11.0+ ARM64 Details for dosi_engine-0.2.2-cp312-abi3-macosx_11_0_arm64.whl
dosi_engine-0.2.2-cp312-abi3-macosx_10_12_x86_64.whl CPython 3.12 abi3 macOS 10.12+ x86-64 Details for dosi_engine-0.2.2-cp312-abi3-macosx_10_12_x86_64.whl

Total release size: 367.2 MB

Release files / dosi_engine-0.2.2-cp312-abi3-win_amd64.whl

Download URL dosi_engine-0.2.2-cp312-abi3-win_amd64.whl
Size 58.9 MB
Tags CPython 3.12 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
ec9b6380f0a9e56089ebe83b07446cd1b7a32e08ae66f617578120f05d811a06
BLAKE2b-256 checksum
How to use checksums
8ee52fc048ee249e63527f9e6061171767556e3bac3508fff50a69ba44a61f21
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / dosi_engine-0.2.2-cp312-abi3-manylinux_2_28_x86_64.whl

Download URL dosi_engine-0.2.2-cp312-abi3-manylinux_2_28_x86_64.whl
Size 73.7 MB
Tags CPython 3.12 Linux glibc 2.28+ x86-64 abi3
SHA-256 checksum
How to use checksums
d4a4e36602fd843414b4f46e741513ae6bee718bdd3e95b8edf23d06bfc36efb
BLAKE2b-256 checksum
How to use checksums
753a0eefc142d847c182eec4bf551d8cb309c30d9da463a016f0be963811262a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / dosi_engine-0.2.2-cp312-abi3-manylinux_2_28_aarch64.whl

Download URL dosi_engine-0.2.2-cp312-abi3-manylinux_2_28_aarch64.whl
Size 73.1 MB
Tags CPython 3.12 Linux glibc 2.28+ ARM64 abi3
SHA-256 checksum
How to use checksums
9f00bb28043864ca74b33bde680ba9ad96947413876869379d3eebaf37f418a1
BLAKE2b-256 checksum
How to use checksums
9fbc564b2055bd81737cabe652744fcf0231802f4bd2db287e34fafeca1c08c4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / dosi_engine-0.2.2-cp312-abi3-macosx_11_0_arm64.whl

Download URL dosi_engine-0.2.2-cp312-abi3-macosx_11_0_arm64.whl
Size 80.0 MB
Tags CPython 3.12 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
8a524a88aa2e7dc3afdc28bcdfcd41e4808828906818c9a0ed97a9534eca99a2
BLAKE2b-256 checksum
How to use checksums
7f68877aa71a7978c188917d34bf04f984241c66f12339cd500993e3f30d2ed5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / dosi_engine-0.2.2-cp312-abi3-macosx_10_12_x86_64.whl

Download URL dosi_engine-0.2.2-cp312-abi3-macosx_10_12_x86_64.whl
Size 81.6 MB
Tags CPython 3.12 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
5ef1123e7b206b4b8e6151b7e5bbed97cc2249ac90ba0d582813e39234f1b7e4
BLAKE2b-256 checksum
How to use checksums
1bfbf5efed978c363d20eaec7ccc234ea121e7081b6c0121957801c4a031595b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Security for dosi-engine 0.2.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