Sidemantic

Define metrics once, query them anywhere with SQL or Python

Compatible with 8+ formats: Cube, MetricFlow (dbt), LookML (Looker), Hex, Rill, Superset, Omni, or native Sidemantic YAML.

# Define once
models:
  - name: orders
    table: orders
    metrics:
      - name: revenue
        agg: sum
        sql: amount
# Query with SQL
layer.sql("SELECT revenue FROM orders WHERE status = 'completed'")

# Or use Python API
layer.query(
    metrics=["orders.revenue"],
    dimensions=["orders.status"],
    filters=["orders.status = 'completed'"]
)

Why Sidemantic?

Governed calculations. Define metrics once and query them consistently. No more copy-pasting formulas or maintaining duplicate logic across dashboards and reports.

Accurate by design. Prevents common errors like join fan-out, incorrect aggregations, and double-counting through relationship-aware query generation.

Smart automation. Automatic joins across models, dependency detection, and multi-hop relationship discovery.

Rich metric types. From simple aggregations to ratios, time comparisons, conversion funnels, and cumulative calculations.

Flexible and powerful. Jinja2 templating, reusable segments, hierarchies, and inheritance.

Quick Example

# semantic_layer.yml
models:
  - name: orders
    table: orders
    primary_key: order_id

    relationships:
      - name: customer
        type: many_to_one
        foreign_key: customer_id

    dimensions:
      - name: status
        type: categorical
        sql: status

    metrics:
      - name: revenue
        agg: sum
        sql: amount

# Graph-level metrics (dependencies auto-detected!)
metrics:
  - name: total_revenue
    sql: orders.revenue
from sidemantic import SemanticLayer

layer = SemanticLayer.from_yaml("semantic_layer.yml")

# Query with SQL
result = layer.sql("""
    SELECT revenue, status
    FROM orders
    WHERE status = 'completed'
""")

df = result.fetchdf()

Learn More