datus-semantic-dosi
A Datus semantic adapter backed by Dosi, the native Rust OSI engine, with no
MetricFlow dependency. It is a thin protocol translator: the OSI YAML is
loaded, planned, compiled to dialect SQL, and executed entirely inside the Rust
engine (via the dosi-engine pyo3 bindings); this package only maps the Datus
semantic-adapter contract onto the engine's API and its structured errors onto
SemanticValidationError.
service_type: dosi.
Install
The adapter declares the native engine as a normal dependency. One command installs both packages:
pip install datus-semantic-dosi
No separate dosi-engine installation is required.
For local source development, a release is not required. Install the native checkout first, then the adapter into the same environment:
uv pip install -e ../osi-engine/crates/dosi-py
uv pip install -e ./datus-semantic-dosi
Adjust the relative paths to the workspace root. The first command builds the Rust/PyO3 extension with maturin and keeps the Python package linked to the local checkout.
Configure
from datus_semantic_dosi.config import DosiConfig
DosiConfig(
semantic_model_path="model.yaml", # OSI model (.yaml/.yml/.json)
db_config={"type": "sqlite", "uri": "orders.sqlite"}, # or duckdb
)
The adapter passes db_config to the Python engine entirely in memory. The
Rust CLI and server retain connections-file discovery; the embedded Python
surface does not read or write connection files.
SQLite is a storage connector rather than a SQL dialect: Dosi receives
type: sqlite unchanged and executes DuckDB SQL against the file in read-only
mode.
Authoring contract
datus_extension_authoring_spec_text() reads the dialect-neutral authoring
contract from the active dosi-engine Python binding. The adapter keeps its
vendored versioned specifications only as a compatibility fallback for older
engine builds. datus_extension_authoring_spec_digest() exposes a stable
prompt-cache key, while the datasource dialect remains a separate Agent input.
Use with Datus-agent
Install the adapter into the same virtualenv as datus-agent:
uv pip install datus-semantic-dosi
For local development before a registry release, install both checkouts with
the editable commands above. Entry-point discovery requires an installed
adapter distribution; PYTHONPATH alone is not sufficient.
Then wire it in agent.yml. The semantic_layer key must equal the
service_type (dosi); Datus-agent fills db_config from the active
datasource and semantic_models_path from subject/semantic_models/<datasource>/
automatically, so a model file dropped there needs no further config:
agent:
services:
datasources:
mydb:
type: duckdb
uri: /abs/path/to/orders.db
semantic_layer:
dosi: # key MUST be the service_type
# both optional; either overrides the auto-derived directory:
# semantic_model_path: /abs/path/to/model.yaml # explicit single file
Place OSI model files under <project>/subject/semantic_models/mydb/ (Datus's
per-datasource convention). The adapter catalogs every top-level YAML/YML/JSON
file, keeps one native engine per file, and routes each globally unique metric
name to its owning model. Set semantic_model_path only when an authoring flow
must pin the adapter to one explicit file. Launch with datus --datasource mydb; the ask_metrics node then drives list_metrics / query_metrics
through this adapter.
Behavior notes
attributedelegates to the native engine and returns the shared attribution contract withterm_wise,mix_shift,factor_shapley, or a structuredunsupportedresult.validate_semanticdelegates to the engine's own validator (structure, references, metric compilation) — no separate ossie integration.get_dimensions(metric)projects the engine's metric-scoped dimension catalog unchanged: Dosi owns reachability, conformance, recommendation, and ordering. Every returned row is queryable;recommended=falseis a discovery hint, not a permission check. The adapter uses compile-only planning only to add the supported grains for time dimensions.- Ambiguous / unknown names surface as
SemanticValidationExceptionwhosepayloadcarries the engine'scandidates; single-candidate fixes are turned into a concretesuggested_retry. - Multiple model files are supported for discovery and single-model queries. Metric and semantic-model names must be unique within a datasource; one query cannot combine metrics owned by different files.
- Time granularity attaches only to time dimensions; supplying it with no
time dimension raises a
time_grain_requiredvalidation payload. - Native time axis accepts
metric_timeplustime_granularity; a suffixed result column is an output/order key, not a query dimension. - Window discovery exposes native structured-window metadata and rejects legacy
grain_to_date,window_aggregation,period_over_period, and stringwindowhints instead of silently executing the base aggregate. - Engine instances and the metric routing catalog refresh when model files are added, removed, or changed.
Tests
Unit tests run against a fake binding (no native build needed):
ci/run-unit-tests.sh datus-semantic-dosi. Integration tests
(-m integration) need the real local or installed dosi-engine binding and the duckdb CLI used
to seed the test fixture,
and use the vendored tests/fixtures/orders/ copy.
Metadata
Release files for datus-semantic-dosi 0.1.15
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| datus_semantic_dosi-0.1.15.tar.gz | 57.5 kB | Without provenance | Details for datus_semantic_dosi-0.1.15.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| datus_semantic_dosi-0.1.15-py3-none-any.whl | Python 3 | none | any | Details for datus_semantic_dosi-0.1.15-py3-none-any.whl |
Total release size: 101.0 kB
Release files / datus_semantic_dosi-0.1.15.tar.gz
| Download URL | datus_semantic_dosi-0.1.15.tar.gz |
|---|---|
| Size | 57.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b73e37cf9f16e510b1358c4c4fa4d407e674ba0c22656521c4eb186183d1a070
|
|
BLAKE2b-256 checksum How to use checksums |
dddbb66a8ef578ea100e549c69d5a832accf749a8f106bba70edda84bd8875ec
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.14
|
Release files / datus_semantic_dosi-0.1.15-py3-none-any.whl
| Download URL | datus_semantic_dosi-0.1.15-py3-none-any.whl |
|---|---|
| Size | 43.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
24b9146c81c7e0c4bf76ceea0c9299dd300da3e7ea6a61cc24bd0f04c0a1e654
|
|
BLAKE2b-256 checksum How to use checksums |
80eaaecf6475029a4a28f8636c9ea2ee8f7aca3291c3955fd5a75e8383487909
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.14
|
Security for datus-semantic-dosi 0.1.15
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.