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.1

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.1
File Actions
dosi_engine-0.2.1-cp312-abi3-win_amd64.whl CPython 3.12 abi3 Windows x86-64 Details for dosi_engine-0.2.1-cp312-abi3-win_amd64.whl
dosi_engine-0.2.1-cp312-abi3-manylinux_2_28_x86_64.whl CPython 3.12 abi3 Linux glibc 2.28+ x86-64 Details for dosi_engine-0.2.1-cp312-abi3-manylinux_2_28_x86_64.whl
dosi_engine-0.2.1-cp312-abi3-manylinux_2_28_aarch64.whl CPython 3.12 abi3 Linux glibc 2.28+ ARM64 Details for dosi_engine-0.2.1-cp312-abi3-manylinux_2_28_aarch64.whl
dosi_engine-0.2.1-cp312-abi3-macosx_11_0_arm64.whl CPython 3.12 abi3 macOS 11.0+ ARM64 Details for dosi_engine-0.2.1-cp312-abi3-macosx_11_0_arm64.whl
dosi_engine-0.2.1-cp312-abi3-macosx_10_12_x86_64.whl CPython 3.12 abi3 macOS 10.12+ x86-64 Details for dosi_engine-0.2.1-cp312-abi3-macosx_10_12_x86_64.whl

Total release size: 353.4 MB

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

Download URL dosi_engine-0.2.1-cp312-abi3-win_amd64.whl
Size 56.4 MB
Tags CPython 3.12 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
d5be43246db2c13875db416edbd90c193e9e7c1c6eb90649819a98549494bc90
BLAKE2b-256 checksum
How to use checksums
a4c26bbc723cedbd585d0ab87a14eaf171d549e270cc815dc1ccdef978352480
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.1-cp312-abi3-manylinux_2_28_x86_64.whl

Download URL dosi_engine-0.2.1-cp312-abi3-manylinux_2_28_x86_64.whl
Size 71.1 MB
Tags CPython 3.12 Linux glibc 2.28+ x86-64 abi3
SHA-256 checksum
How to use checksums
9cd2dd768889a0929ac61d438ffa9d17d416b3662433cc49d233a1e927e91a9f
BLAKE2b-256 checksum
How to use checksums
c0fbfd8a751136c7a23a99517878c8889b770211de67bda52ce45d33897d78ee
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.1-cp312-abi3-manylinux_2_28_aarch64.whl

Download URL dosi_engine-0.2.1-cp312-abi3-manylinux_2_28_aarch64.whl
Size 70.4 MB
Tags CPython 3.12 Linux glibc 2.28+ ARM64 abi3
SHA-256 checksum
How to use checksums
1937bcff629e3015c24bd834d6d91361c4a96ac96e2ccc0e9e2d54aefd26b1bf
BLAKE2b-256 checksum
How to use checksums
4e460cde888b488a9f17f7a44beeb48c5abf8428c0605931146fa6ac932b97e3
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.1-cp312-abi3-macosx_11_0_arm64.whl

Download URL dosi_engine-0.2.1-cp312-abi3-macosx_11_0_arm64.whl
Size 76.4 MB
Tags CPython 3.12 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
8e14691fd1840c52b5935b1f941b761ecc5ca3cc852b31b7d6e185cfdff44bda
BLAKE2b-256 checksum
How to use checksums
43394a0ca83f11bbd2d1bc402c0cd7cab043fa15951beb6db7f2df692c821346
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.1-cp312-abi3-macosx_10_12_x86_64.whl

Download URL dosi_engine-0.2.1-cp312-abi3-macosx_10_12_x86_64.whl
Size 79.1 MB
Tags CPython 3.12 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
7e5014868af7a47693b78e2fb62914ce8203d0187c6fccabd7fcd43254b7297d
BLAKE2b-256 checksum
How to use checksums
d69eb33bc374ac3329a8689b5a42f1d7be22cffa204c32b633d615f8b1ebbc4f
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.1

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