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.
Configure
from datus_semantic_dosi.config import DosiConfig
DosiConfig(
semantic_model_path="model.yaml", # OSI model (.yaml/.yml/.json)
db_config={"type": "duckdb", "uri": "orders.db"}, # or connections_path=...
)
Connection precedence: an explicit connections_path (agent.yml or a
standalone datasources: YAML, consumed verbatim by the engine) wins over an
inline db_config (one agent.yml datasource entry, written to a temporary
connections file). With neither, the engine falls back to its own discovery
order and, failing that, local DuckDB.
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 PyPI release, install the adapter checkout and a
locally built dosi_engine-*.whl together. Entry-point discovery requires an
installed 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
# connections_path: /abs/path/to/agent.yml # reuse a connections file
Place one OSI model file at <project>/subject/semantic_models/mydb/model.yaml
(Datus's per-datasource convention). The adapter resolves a single file in that
directory automatically; if the directory holds several models, set
semantic_model_path to pick one (the engine loads exactly one model per
document). Launch with datus --datasource mydb; the ask_metrics node then
drives list_metrics / query_metrics through this adapter.
Behavior notes
validate_semanticdelegates to the engine's own validator (structure, references, metric compilation) — no separate ossie integration.get_dimensions(metric)returns every dimension in the model (v1): relationship-reachable dimensions are genuinely queryable, and the planner rejects invalid combinations with structured, retryable errors.- Ambiguous / unknown names surface as
SemanticValidationExceptionwhosepayloadcarries the engine'scandidates; single-candidate fixes are turned into a concretesuggested_retry. - Time granularity attaches only to time dimensions; supplying it with no
time dimension raises a
time_grain_requiredvalidation payload. - The engine instance is rebuilt when the model file's mtime changes.
Tests
Unit tests run against a fake binding (no wheel needed):
ci/run-unit-tests.sh datus-semantic-dosi. Integration tests
(-m integration) need the real dosi-engine wheel and the duckdb CLI used
to seed the test fixture,
and use the vendored tests/fixtures/orders/ copy.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file datus_semantic_dosi-0.1.1.tar.gz.
File metadata
- Download URL: datus_semantic_dosi-0.1.1.tar.gz
- Upload date:
- Size: 20.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.12.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d418a201a58aa26a8cce2bcc2d329813983e1e53fd48b45dd9014eeb0c8f7f35
|
|
| MD5 |
d0967f63eacdb29d2245c7a3afd6f967
|
|
| BLAKE2b-256 |
69073efa66bda3320f556917d7e91d3a82d3ffe080af11971278536955115d5a
|
File details
Details for the file datus_semantic_dosi-0.1.1-py3-none-any.whl.
File metadata
- Download URL: datus_semantic_dosi-0.1.1-py3-none-any.whl
- Upload date:
- Size: 15.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.12.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bf23d8c207eb21f2c92c63935340d828dc7d8276cb15cde84074226234eceadb
|
|
| MD5 |
d7a95f253d255aa3c6a1aa768cce8171
|
|
| BLAKE2b-256 |
a58dc88ba8cca0fae10a5d92826200bcdcb7aedd6ea7b26b17b830d95c76c7b9
|