MetricFlow adapter for Datus semantic layer
Project description
datus-semantic-metricflow
MetricFlow adapter for Datus semantic layer.
Installation
pip install datus-semantic-metricflow
Dependencies (datus-metricflow, pydantic) will be installed automatically.
Requirements
- Python >= 3.12
Quick Start
import asyncio
from datus_semantic_metricflow import MetricFlowAdapter, MetricFlowConfig
config = MetricFlowConfig(
namespace="my_project",
config_path="/path/to/metricflow/config", # optional
)
adapter = MetricFlowAdapter(config)
async def main():
# List metrics
metrics = await adapter.list_metrics(limit=10)
for metric in metrics:
print(f"{metric.name}: {metric.description}")
# Get dimensions for a metric
dimensions = await adapter.get_dimensions("revenue")
for dim in dimensions:
print(f"{dim.name}: {dim.description}")
# Query metrics
result = await adapter.query_metrics(
metrics=["revenue", "orders"],
dimensions=["date", "region"],
limit=100,
)
print(f"Columns: {result.columns}")
print(f"Data: {result.data[:5]}")
asyncio.run(main())
Configuration
| Field | Type | Default | Description |
|---|---|---|---|
namespace |
str | Required | Namespace for this semantic layer instance |
config_path |
str | None | Path to MetricFlow configuration file |
timeout |
int | 300 | Query timeout in seconds |
API
list_metrics(path=None, limit=100, offset=0)- List available metricsget_dimensions(metric_name, path=None)- Get dimensions for a metricquery_metrics(metrics, dimensions=[], ...)- Execute metric queriesvalidate_semantic()- Validate configuration files
Development
pip install -e ".[dev]"
pytest
Project details
Release history Release notifications | RSS feed
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_metricflow-0.1.2.tar.gz.
File metadata
- Download URL: datus_semantic_metricflow-0.1.2.tar.gz
- Upload date:
- Size: 9.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c8eee2286bf97f4938a782a4afb5441ebade26587988d01074ef97e9975fc5ac
|
|
| MD5 |
67c1c1e30c8478aaebc3e73cdd27e7b7
|
|
| BLAKE2b-256 |
52fb75b1a4d9e9307dcc8efee5f7df810256c1894eebfe955fa4a3c5dd537391
|
File details
Details for the file datus_semantic_metricflow-0.1.2-py3-none-any.whl.
File metadata
- Download URL: datus_semantic_metricflow-0.1.2-py3-none-any.whl
- Upload date:
- Size: 11.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5a48070b560df5eded9323af390a90f2d0fa326116308eaf6c32a0b1a167cf94
|
|
| MD5 |
87e7988718a56aa97e88054937ecf864
|
|
| BLAKE2b-256 |
86d26599f84f2b774c0323b03807b194a4fa89da21513dd608c2f35518806998
|