Skip to main content

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 metrics
  • get_dimensions(metric_name, path=None) - Get dimensions for a metric
  • query_metrics(metrics, dimensions=[], ...) - Execute metric queries
  • validate_semantic() - Validate configuration files

Development

pip install -e ".[dev]"
pytest

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

datus_semantic_metricflow-0.1.3.tar.gz (9.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

datus_semantic_metricflow-0.1.3-py3-none-any.whl (11.3 kB view details)

Uploaded Python 3

File details

Details for the file datus_semantic_metricflow-0.1.3.tar.gz.

File metadata

File hashes

Hashes for datus_semantic_metricflow-0.1.3.tar.gz
Algorithm Hash digest
SHA256 38f31d5e429a45aed23b3a94a7218f3981121eef9f6e6fd5b84878e2bca4c5b0
MD5 53ec60192bb3a626039a0268b9b336ff
BLAKE2b-256 5d575f84f647530e31ae25a2b80676f2de79eed7215ddc5812b61de403b76304

See more details on using hashes here.

File details

Details for the file datus_semantic_metricflow-0.1.3-py3-none-any.whl.

File metadata

File hashes

Hashes for datus_semantic_metricflow-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 43b35c5bbf21940de264d84c7eeb9447ebaa1ecf97913c55be3cf8f13fa31b79
MD5 bcff6f715ae56881a16ef95df1876baa
BLAKE2b-256 4f0862effd0d1bcd6a69d3f1711569ed372134125c10eec5a2faa98d76fed790

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page