OrionBelt Semantic Layer 标志

OrionBelt Semantic Layer

组织
ralforion

Source-available semantic layer and sidecar for agentic AI and governed analytics. Compiles declarative YAML models into optimized SQL, KPIs, and semantic context across 8 SQL dialects.

发布者ralforion
代码仓库orionbelt-semantic-layer
语言Python
复刻数
9
星标数
95
可用工具
0
传输类型stdio
分类
链接
  • 将工具接入 AI 工作流

    OrionBelt Semantic Layer 提供 MCP 功能,可供兼容的 AI 客户端和智能体使用。

  • 0 个可用工具

    浏览下方可调用的操作;如果服务器提供了名称和描述,也会一并显示。

  • 可直接复制的配置

    使用安装配置片段,在您首选的 MCP 客户端中配置此服务器。

  • 开源社区热度

    关联的代码仓库有 95 个星标和 9 个复刻。


Ask an LLM to write SQL against a raw star schema and sooner or later it joins two fact tables and hands you a revenue number inflated by a factor of eight. It looks right. Nobody catches it.

OrionBelt is a semantic sidecar. You declare dimensions, measures, metrics, and joins in version-controlled YAML. OrionBelt compiles them into dialect-specific SQL through a real AST, and routes multi-fact queries through a Composite Fact Layer planner that blocks the join paths that produce fan traps. Agents and BI tools ask for "Total Revenue" by "Country". They never see a table name.

No BI tool in the middle. No runtime lock-in. Point it at what you already have.

Four ways in

The same model serves every surface you already use. Four of them, and one model behind all four:

SurfacePortSpeaksConnect with
PostgreSQL wire5432Postgres protocolDuckDB via ATTACH, Tableau, Dremio as a federated source, Power BI, Superset, DBeaver, Metabase, psql
Arrow Flight SQL8815gRPC + ArrowDuckDB via adbc_scanner, Tableau and Power BI through the Flight SQL JDBC/ODBC drivers, ADBC clients (Python, Go, Java)
REST8000HTTP + JSONyour code, notebooks, curl, and the 8 PEP 249 drivers (which compile here, then execute on the warehouse directly)
MCPstdio / HTTPModel Context ProtocolAI agents: Claude, Cursor, Copilot, Windsurf

Both SQL surfaces speak OBSQL, so SELECT "Region", "Total Sales" FROM sales_model is the same query whichever one you came in through. ADBC is how you use the Flight SQL surface rather than a fifth surface of its own, and DuckDB is a client that can take either SQL surface.

Eight ways out

Compiles to BigQuery, ClickHouse, Databricks, Dremio, DuckDB/MotherDuck, MySQL, PostgreSQL, and Snowflake. The warehouse behind the model is independent of the surface in front of it: any of the four surfaces, against any of the eight dialects.

Here is TPC-DS query 98. Two measures over the same column, identical but for one line: Class Revenue is pinned to a coarser grain than the query asks for.

yaml
measures:
  Store Sales Amount:
    columns: [{dataObject: Store Sales, column: Ext Sales Price}]
    aggregation: sum

  Class Revenue:
    columns: [{dataObject: Store Sales, column: Ext Sales Price}]
    aggregation: sum
    grain: {mode: FIXED, keepOnly: [Class]}   # <- pin to Class, ignore query grain

metrics:
  Revenue Ratio:
    expression: "{[Store Sales Amount]} * 100.0 / {[Class Revenue]}"

That one grain line is what becomes SUM(...) OVER (PARTITION BY "Class") below.

The query names business concepts. No tables, no joins, no SQL:

yaml
select:
  dimensions: [Item ID, Item Description, Category, Class, Current Price]
  measures: [Store Sales Amount, Revenue Ratio]
where:
  - {field: Category, op: inlist, value: [Sports, Books, Home]}
  - {field: Order Date, op: between, value: ["1999-02-22", "1999-03-24"]}
bash
pip install orionbelt-semantic-layer
obsl compile tpcds.obml.yml -q Q98.yml -d duckdb
sql
WITH "base" AS (
  SELECT
    "Item"."i_item_id" AS "Item ID",
    "Item"."i_item_desc" AS "Item Description",
    "Item"."i_category" AS "Category",
    "Item"."i_class" AS "Class",
    "Item"."i_current_price" AS "Current Price",
    CAST(SUM("Store Sales"."ss_ext_sales_price") AS DECIMAL(18, 2)) AS "Store Sales Amount",
    SUM("Store Sales"."ss_ext_sales_price") AS "Class Revenue"
  FROM "main"."store_sales" AS "Store Sales"
  LEFT JOIN "main"."item" AS "Item"
    ON "Store Sales"."ss_item_sk" = "Item"."i_item_sk"
  LEFT JOIN "main"."date_dim" AS "Date"
    ON "Store Sales"."ss_sold_date_sk" = "Date"."d_date_sk"
  WHERE
    "Item"."i_category" IN ('Sports', 'Books', 'Home')
    AND "Date"."d_date" BETWEEN '1999-02-22' AND '1999-03-24'
  GROUP BY ALL
)
SELECT
  "Item ID" AS "Item ID",
  "Item Description" AS "Item Description",
  "Category" AS "Category",
  "Class" AS "Class",
  "Current Price" AS "Current Price",
  "Store Sales Amount" AS "Store Sales Amount",
  "Store Sales Amount" * 100.0 / NULLIF(SUM("Class Revenue") OVER (PARTITION BY "Class"), 0) AS "Revenue Ratio"
FROM "base" AS "base"
ORDER BY
  "Category" ASC,
  "Class" ASC,
  "Item ID" ASC,
  "Item Description" ASC,
  "Revenue Ratio" ASC

You did not write the join path, the window function over an aggregate, the NULLIF guard, or one table name. Change -d duckdb to -d snowflake and the same two files compile for Snowflake, or for any of eight dialects.

This is checked, not asserted. 40 TPC-DS queries are built against a single OBML model and compared row by row against each engine's own reference SQL: 39 of 40 match on DuckDB at sf=1, 37 of 40 on ClickHouse at sf=10. Every one of the remaining differences traces to a reference variant rather than a compilation error, and each is documented. See the sweep, or the queries in examples/tpcds_queries/.

Where OrionBelt fits

OrionBelt is a sidecar, not a platform. It compiles a YAML model into correct SQL and exposes it over the protocols you already use. It does not run a cluster, own your cache, or ask you to adopt a cloud.

Reach for OrionBelt when:

  • Agents query your data and a silently wrong number is unacceptable. Multi-fact queries route through a Composite Fact Layer planner that blocks fan-trap join paths instead of quietly summing across them.
  • You want your metric definitions in reviewable YAML, with no JavaScript or Python in the model layer.
  • Your BI tool should connect over the Postgres driver it already ships, with no new connector to install and no vendor runtime in the path.
  • You self-host, across more than one engine, and want one model to compile for all of them.

Reach for something else when:

  • You need pre-aggregation and caching tuned for high-concurrency dashboards at scale. Cube has years of production hardening there that OrionBelt does not.
  • Your metrics already live in dbt and your team is happy there. MetricFlow keeps them where they are.
  • You want an exploratory analysis language rather than a serving layer. Malloy is a better fit.

Try the live demo with a pre-loaded model, or open the Colab notebook and run it against TPC-H data.

Meaning, not just metrics

A model that only knows that Total Sales is a sum still leaves the agent guessing what a high-value client is, or whether a category selling at a loss is a bug or a fact. Since 2.30 the model carries that too.

Business rules are conditions over the model's own dimensions, measures and metrics, with no SQL. The engine compiles each one to the query that reports its findings: the members of a classification or eligibility rule, the violations of a validation or constraint rule.

yaml
rules:
  Non-Negative Margin:
    type: validation
    severity: error
    description: Every product category must sell for at least what it cost
    grain: [Product Category]
    condition: {field: Gross Margin, op: ">=", value: 0}

This rule reads a metric, so it is aggregate: it becomes a HAVING at the category grain through the same planner as any query, multi-fact included. POST /v1/rules/{name}/evaluate returns the offending categories for this rule, and POST /v1/rules/evaluate runs every rule into one report.

Ontology links tie artefacts to the concepts your organisation already governs, as SKOS mapping relations with provenance:

yaml
ontology:
  prefixes:
    schema: "https://schema.org/"

dataObjects:
  Products:
    externalConceptMappings:
      - concept: schema:Product
        relation: exact
        justification: curated

Links never change the SQL. They change what can be asked: every loaded model is also an RDF graph, so "which artefacts mean a schema.org Product" is a SPARQL query, and the discovery API answers the same over REST (/concept-mappings, its /namespaces, and the /unmapped gap list).

For an agent this is the difference between guessing and looking it up. Over MCP, list_rules, evaluate_rule and find_concept_mappings sit next to execute_query as tools.

Guides: Business Rules, External Concept Mappings, OBSL Graph & SPARQL.

Contents

Four ways in · Meaning, not just metrics · Try it in 30 seconds · Claude Desktop / MCP · Why OrionBelt? · Features · Example · Documentation · Roadmap · Commercial · Development


Try it in 30 Seconds

Option A: Live Demo (no install)

Open the Live Demo — Gradio UI with a pre-loaded example model. Paste a query, pick a dialect, see SQL instantly.

API explorer: Swagger UI | ReDoc

Want to try the PostgreSQL wire surface? Cloud Run is HTTPS-only, so the public demo can't expose ports 5432 (pgwire) or 8815 (Flight SQL). Spin the same demo up locally in two commands — it includes the baked-in orionbelt_1_commerce DuckDB dataset and the full OBSQL surface:

bash
docker run --rm -d --name orionbelt-demo \
  -p 8080:8080 -p 5432:5432 -p 8815:8815 \
  -e PGWIRE_ENABLED=true \
  -e FLIGHT_ENABLED=true \
  ralforion/orionbelt-semantic-layer-api:latest

# REST + Gradio UI:   http://localhost:8080/ui
# pgwire (any psql / DBeaver / Tableau / Power BI):
psql "host=localhost port=5432 user=obsl dbname=orionbelt_1_commerce sslmode=disable" \
  -c 'SELECT "Client Name", "Total Sales" LIMIT 5'
# Flight SQL smoke test:
uv run python examples/obsql.py 'SELECT "Client Name", "Total Sales" LIMIT 5'

docker stop orionbelt-demo

The container ships with PGWIRE_AUTH_MODE=trust (default), so it's safe for localhost but not safe to expose to the public internet. For exposed deployments, set AUTH_MODE=api_key (shipped in v2.12.0): pgwire then negotiates SCRAM-SHA-256 (or cleartext over TLS) against the shared key store.

Option B: Google Colab (no install)

Open In Colab — Interactive notebook with TPC-H data: explore the model, compile queries across dialects, execute against DuckDB, and see results. Requires Python 3.12 runtime.

Option C: Install from PyPI

bash
pip install orionbelt-semantic-layer

Then paste into a Python REPL:

python
from orionbelt.parser import ReferenceResolver, TrackedLoader
from orionbelt.compiler.pipeline import CompilationPipeline
from orionbelt.models.query import QueryObject, QuerySelect

model_yaml = """
version: 1.0
dataObjects:
  Orders:
    code: ORDERS
    columns:
      Price: { code: PRICE, abstractType: float }
      Country: { code: COUNTRY, abstractType: string }
dimensions:
  Country:
    dataObject: Orders
    column: Country
    resultType: string
measures:
  Total Revenue:
    resultType: float
    aggregation: sum
    expression: "{[Orders].[Price]}"
"""

loader = TrackedLoader()
raw, source_map = loader.load_string(model_yaml)
resolver = ReferenceResolver()
model, result = resolver.resolve(raw, source_map)

query = QueryObject(select=QuerySelect(dimensions=["Country"], measures=["Total Revenue"]))
pipeline = CompilationPipeline()
output = pipeline.compile(query, model, "postgres")
print(output.sql)

Output:

sql
SELECT
  "Orders"."COUNTRY" AS "Country",
  CAST(SUM("Orders"."PRICE") AS NUMERIC(18, 2)) AS "Total Revenue"
FROM ORDERS AS "Orders"
GROUP BY "Orders"."COUNTRY"

No env file needed — the compilation pipeline is stateless.

Start the servers:

bash
orionbelt-api                              # REST API on :8000 (Swagger UI at /docs, Gradio UI at /ui)
orionbelt-ui                               # standalone Gradio UI on :7860 (connects to API on :8000)
FLIGHT_ENABLED=true orionbelt-api          # API + Arrow Flight SQL on :8815 (DBeaver, Tableau, Power BI)
PGWIRE_ENABLED=true orionbelt-api          # API + PostgreSQL wire on :5432 (Tableau, DBeaver, Superset, psql, Dremio source)

Option C2: Install with uv

bash
uv pip install orionbelt-semantic-layer
bash
uv run orionbelt-api                       # REST API on :8000 (Swagger UI at /docs, Gradio UI at /ui)
uv run orionbelt-ui                        # standalone Gradio UI on :7860 (connects to API on :8000)
FLIGHT_ENABLED=true uv run orionbelt-api   # API + Arrow Flight SQL on :8815 (DBeaver, Tableau, Power BI)
PGWIRE_ENABLED=true uv run orionbelt-api   # API + PostgreSQL wire on :5432 (Tableau, DBeaver, Superset, psql, Dremio source)

Use the obsl CLI (no server needed - compiles in-process):

bash
obsl validate model.yaml                                  # lint a model (exit 1 on error, CI-friendly)
obsl compile model.yaml -q query.json -d snowflake        # print the generated SQL
obsl compile model.yaml --sql 'SELECT "Region", "Sales" FROM model'  # ... or from an OBSQL string
obsl describe model.yaml                                   # overview of data objects + artefacts
obsl diagram model.yaml                                    # Mermaid ER diagram
obsl convert obml-to-osi model.yaml                        # OBML -> OSI (and osi-to-obml)
obsl execute -q query.json --server http://host           # run against a deployed model (omit MODEL)

See the CLI guide for all commands.

Smoke-test the Flight SQL surface without a BI tool:

bash
uv run python examples/obsql.py 'SELECT version()'
uv run python examples/obsql.py 'SHOW TABLES'
uv run python examples/obsql.py 'SELECT "Region", "Total Sales" FROM sales LIMIT 5'

# Multi-model deployment? Pick the model with -m:
uv run python examples/obsql.py -m sales 'SHOW TABLES'
uv run python examples/obsql.py --list   # discover loaded models via REST

Try OBSQL in 30 seconds

OBSQL — OrionBelt Semantic QL — is the SQL surface BI tools and humans actually write. Bare labels, MEASURE() markers, or matching aggregate wrappers; aggregation-match validation; WITH ROLLUP / WITH CUBE; no escape hatch to raw warehouse SQL. Same language over Arrow Flight SQL (v2.4+) and PostgreSQL wire (v2.5+):

bash
PGWIRE_ENABLED=true uv run orionbelt-api &

# Every BI tool already ships a Postgres ODBC/JDBC driver — point yours at :5432
psql "host=localhost port=5432 user=obsl dbname=sales sslmode=disable" \
  -c 'SELECT "Region", "Total Sales" LIMIT 5'

# All three measure forms compile to the same vendor SQL:
psql "..." -c 'SELECT "Region", "Total Sales"        FROM sales LIMIT 5'  -- bare
psql "..." -c 'SELECT "Region", MEASURE("Total Sales") FROM sales LIMIT 5'  -- explicit marker
psql "..." -c 'SELECT "Region", SUM("Total Sales")   FROM sales LIMIT 5'  -- matching aggregate

See the OBSQL reference for the full grammar.

Option D: Docker

Stage 1 — Zero-config start (models loaded later via API or UI):

bash
docker run -p 8080:8080 ralforion/orionbelt-semantic-layer-api

Open http://localhost:8080/docs to explore the API.

Stage 2 — Realistic setup with docker compose:

yaml
# docker-compose.yml
services:
  api:
    image: ralforion/orionbelt-semantic-layer-api:2.30.0
    ports: ["8080:8080"]
    env_file: .env
    volumes:
      - ./models:/app/models:ro
    environment:
      MODEL_FILES: /app/models/my-model.obml.yml

  ui:
    image: ralforion/orionbelt-semantic-layer-ui:2.30.0
    ports: ["7860:7860"]
    environment:
      API_BASE_URL: http://api:8080
bash
docker compose up -d

See .env.template for the full environment variable reference.

Docker notes:

  • API_SERVER_HOST is already 0.0.0.0 inside the container — no override needed.
  • MCP via stdio does not work in Docker. Use the MCP HTTP client for containerized deployments.
  • Mount models to /app/models (or any path) and set MODEL_FILES (comma-separated paths) to pre-load on startup.
  • For production, pin a version tag (:2.30.0) rather than :latest.

Claude Desktop / MCP

The MCP server is a separate thin client that delegates to the REST API:

orionbelt-semantic-layer-mcp

Add to your Claude Desktop claude_desktop_config.json:

json
{
  "mcpServers": {
    "orionbelt": {
      "command": "uvx",
      "args": ["orionbelt-semantic-layer-mcp"]
    }
  }
}

Also works with Copilot, Cursor, and Windsurf. See the MCP repo for full setup options.


Why OrionBelt?

OrionBeltdbt Semantic LayerCubeMalloy
Model formatYAML-only (OBML)Python + YAMLJavaScriptCustom DSL
SQL generationAST-based (injection-safe)String templatesString templatesCompiler
Multi-dialect8 dialects, no runtime lock-indbt Cloud requiredCube Cloud or self-hostBigQuery-focused
Multi-fact queriesStar Schema + CFL planner (fan-trap prevention)LimitedPre-aggregationsAutomatic joins
Integration surfaceREST API + MCP + Gradio UIdbt Cloud APIREST + GraphQLVS Code extension
DeploymentSelf-host anywhere, single binarySaaS (Cloud)SaaS or self-hostLibrary
LicenseBUSL-1.1 (converts to Apache 2.0)Apache 2.0AGPL / proprietaryMIT
Business meaning in the modelRules compiled to the query that reports their findings; SKOS links to an external ontologyColumn-level data tests; free-form metaFree-form meta (ai_context)Annotations, uninterpreted

Features

Semantic Modeling

  • OBML Format — YAML-based semantic models with data objects, dimensions, measures, metrics, and joins
  • Cross-Schema Queries — model data objects across multiple databases and schemas in a single model
  • Static Model Filters — mandatory WHERE conditions baked into the model, auto-applied with join extension
  • Business Rules — declarative rules over dimensions, measures and metrics (classification, eligibility, validation, constraint) without SQL; compiled to the query that reports their findings, tested one at a time or all at once into a report, listed and evaluated from the UI's Business Rules tab
  • OBSL Graph & SPARQL — RDF graph export and read-only SPARQL querying for every loaded model; external concept mappings link data objects, dimensions, measures and metrics to a business ontology (FIBO, schema.org, a corporate glossary) as SKOS matches
  • OSI Interoperability — bidirectional conversion between OBML and the Open Semantic Interchange format, now developed as Apache Ossie (incubating)

SQL Compilation

  • 8 SQL Dialects — BigQuery, ClickHouse, Databricks, Dremio, DuckDB/MotherDuck, MySQL, Postgres, Snowflake
  • AST-Based Generation — custom SQL AST ensures correct, injection-safe SQL (not string templates)
  • Star Schema & CFL — automatic join resolution with Composite Fact Layer for multi-fact queries
  • Data Types & Precision — automatic CAST wrapping with dialect-specific type rendering and precision clamping
  • Display Formatting — number format patterns (#,##0.00, 0.00%) on measures/metrics with locale-aware rendering
  • Timezone Settings — auto-detect database session timezone with defaultTimezone fallback and ISO 8601 serialization
  • sqlglot Validation — post-generation syntax check across all supported dialects

Integration Surface

  • REST API — FastAPI endpoints for model management, validation, compilation, and execution
  • MCP Server — separate thin client for Claude, Copilot, Cursor, Windsurf
  • AI Integrations — LangChain, OpenAI Agents SDK, CrewAI, Google ADK, Vercel AI SDK, n8n, ChatGPT
  • Gradio UI — interactive web interface for model editing, query testing, and ER diagrams
  • DB-API 2.0 + Flight SQL — PEP 249 drivers and Arrow Flight SQL server for DBeaver, Tableau, Power BI; ships with examples/obsql.py, a tiny terminal CLI for testing the Flight surface without a BI tool
  • DuckDB as a client (v2.27.1+) - a plain DuckDB shell queries the layer, over either surface. ATTACH ... (TYPE postgres) mounts the model as a table (SELECT ... FROM obsl.sales.model, one SET pg_use_text_protocol = true first); the adbc_scanner community extension does it over Flight SQL with Arrow the whole way. Governed measures join to local tables and land in CREATE TABLE AS. Guide
  • PostgreSQL Wire Protocol (v2.5.0+) — native Postgres-protocol surface on :5432. Every BI tool already ships a Postgres ODBC/JDBC driver, so the user side is "point your existing connection at OBSL and go" — Tableau, DBeaver, Superset, Power BI, plain psql, and Dremio as a federated Postgres source (Dremio → OBSL → optionally back to Dremio's lakehouse, full circle)

Agent-Facing API

  • Model Health on Load — every model load returns a health block with orphan dataObjects, fan-trap risks, and unreachable dimensions — agents skip the defensive second round trip
  • Query Plan Endpoint — POST /query/plan returns the planner's understanding (planner choice, physical tables, join path, would_compile) without compiling SQL or executing; opt-in include_database_explain adds the warehouse's raw EXPLAIN
  • Structured Warnings — every warnings list across the API uses a stable {code, severity, message, path, hint, context} shape with a documented code taxonomy; agents branch on codes instead of parsing messages
  • Fuzzy /find Recovery — when a search produces no exact or synonym hits, deterministic Levenshtein + trigram fallback returns near-miss candidates with scores and reasons
  • Model Examples — optional OBML examples: block of canonical queries; GET /examples (with ?intent= filtering) gives agents one-round-trip discovery of what a model is designed to answer

Freshness-Driven Result Cache

  • Source-level freshness contracts — declare refresh: blocks on dataObject entries (interval / heartbeat / static); the cache derives query TTLs from the contracts of the physical tables a query touched, not from caller guesses
  • Heartbeat invalidation — one POST /v1/heartbeat to a physical table invalidates every cached query that depends on it, across every dataObject and session
  • DuckDB metadata + Parquet results — file-backed cache with type-precise serialization, lazy expiration, LRU capacity sweep; opt-in via CACHE_BACKEND=file
  • Inverts the Cube/dbt/Looker pattern — contracts live on the source, not the semantic abstraction; one source of truth across every cube/explore/saved query reading the table

Developer Experience

  • Source-Position Errors — validation errors report exact YAML line and column
  • ER Diagrams — interactive Mermaid diagrams with zoom and download (MD/PNG/Turtle)
  • Session Management — TTL-scoped sessions with thread-safe model isolation
  • JSON Schema — full OBML and query schema for IDE autocompletion (yaml-language-server)

Example

Define a Semantic Model (OBML)

yaml
# yaml-language-server: $schema=https://raw.githubusercontent.com/ralforion/orionbelt-semantic-layer/main/schema/obml-schema.json
version: 1.0
dataObjects:
  Customers:
    code: CUSTOMERS
    database: WAREHOUSE
    schema: PUBLIC
    columns:
      Customer ID: { code: CUSTOMER_ID, abstractType: string }
      Country:     { code: COUNTRY, abstractType: string }

  Orders:
    code: ORDERS
    database: WAREHOUSE
    schema: PUBLIC
    columns:
      Order Customer ID: { code: CUSTOMER_ID, abstractType: string }
      Price:             { code: PRICE, abstractType: float }
      Quantity:          { code: QUANTITY, abstractType: int }
    joins:
      - joinType: many-to-one
        joinTo: Customers
        columnsFrom: [Order Customer ID]
        columnsTo: [Customer ID]

dimensions:
  Country:
    dataObject: Customers
    column: Country
    resultType: string

measures:
  Revenue:
    resultType: float
    aggregation: sum
    expression: "{[Orders].[Price]} * {[Orders].[Quantity]}"
    dataType: "decimal(18, 2)"

Compile via REST API

bash
# Create a session
curl -s -X POST http://localhost:8080/v1/sessions | jq .session_id
# -> "a1b2c3d4"

# Load the model
curl -s -X POST http://localhost:8080/v1/sessions/a1b2c3d4/models \
  -H "Content-Type: application/json" \
  -d '{"model_yaml": "..."}' | jq .model_id
# -> "abcd1234"

# Compile a query
curl -s -X POST http://localhost:8080/v1/sessions/a1b2c3d4/query/sql \
  -H "Content-Type: application/json" \
  -d '{"model_id":"abcd1234","query":{"select":{"dimensions":["Country"],"measures":["Revenue"]}},"dialect":"postgres"}' \
  | jq -r .sql
sql
SELECT
  "Customers"."COUNTRY" AS "Country",
  CAST(SUM("Orders"."PRICE" * "Orders"."QUANTITY") AS NUMERIC(18, 2)) AS "Revenue"
FROM WAREHOUSE.PUBLIC.ORDERS AS "Orders"
LEFT JOIN WAREHOUSE.PUBLIC.CUSTOMERS AS "Customers"
  ON "Orders"."CUSTOMER_ID" = "Customers"."CUSTOMER_ID"
GROUP BY "Customers"."COUNTRY"

Change dialect to bigquery, clickhouse, databricks, dremio, duckdb, mysql, or snowflake for dialect-specific SQL.


Gradio UI

  • SQL Compiler — side-by-side OBML model and query editors with syntax highlighting, 8 dialect selector, one-click compilation with formatted SQL output and query explain
  • Query Execution — execute compiled queries against a connected database, view results with locale-aware number formatting, response metadata panel, TSV download and clipboard copy (requires QUERY_EXECUTE=true)
  • ER Diagram — interactive Mermaid ER diagram with zoom, column toggle, and download (MD/PNG/Turtle)
  • Ontology Graph — interactive vis-network visualization of the OBML graph (data objects, dimensions, measures, metrics, joins) with toggleable layers and adjustable node spacing
  • Business Rules: the model's rules with statistics; click a row to select one, show its OBML definition, test it or test all rules into a report
  • SPARQL: read-only SELECT / ASK over the model's OBSL graph, in an editor with SPARQL syntax highlighting and a gallery of ready-to-run examples
  • Editor Toolbar — clear, undo, redo, upload, download, and copy buttons on all code editors
  • OSI Import/Export — convert between OBML and OSI formats
  • Dark/Light Mode — toggle via header button, state persisted across sessions

Embedded mode — the UI is mounted at /ui on the API server:

bash
pip install orionbelt-semantic-layer && orionbelt-api
# -> UI at http://localhost:8000/ui

Standalone mode — run API and UI as separate processes:

bash
orionbelt-api                                              # API on :8000
orionbelt-ui                                               # UI on :7860 (connects to API on :8000)
API_BASE_URL=http://remote-api:8080 orionbelt-ui           # point UI to a remote API

Documentation

TopicLink
Full docs siteralforion.com/orionbelt-semantic-layer
Installationgetting-started/installation
Quick Startgetting-started/quickstart
Docker & Deploymentgetting-started/docker
Developmentgetting-started/development
OBML Model Formatguide/model-format
Query Languageguide/query-language
SQL Dialectsguide/dialects
Period-over-Period Metricsguide/period-over-period
Trend Analysis (rank / lag / lead / ntile, partitioned MAs, statistical aggregates)guide/trend-analysis
Compilation Pipelineguide/compilation
OBSL Graph & SPARQLguide/obsl
Business Rulesguide/business-rules
External Concept Mappingsguide/concept-mappings
Gradio UIguide/ui
AI Integrationsguide/integrations
OSI Interoperabilityguide/osi
REST API Endpointsapi/endpoints
DB-API Drivers & Flight SQLdrivers
Architecturereference/architecture
Configurationreference/configuration
Sales Model Walkthroughexamples/sales-model
Multi-Dialect Outputexamples/multi-dialect
Multi-Fact: Sales & Returnsexamples/multi-fact
TPC-DS Benchmarkexamples/tpcds
Quickstart Notebookexamples/quickstart.ipynb
Comparison: Overviewcomparison/
Comparison: vs. dbt Semantic Layercomparison/dbt
Comparison: vs. Malloycomparison/malloy
Comparison: vs. LookML / Lookercomparison/lookml
Comparison: vs. Cubecomparison/cube
Comparison: vs. AtScalecomparison/atscale

Status & Roadmap

StatusArea
Shipped8 SQL dialects, REST API, MCP server, Gradio UI, DB-API drivers, Flight SQL, PostgreSQL wire protocol (v2.5.0+) — Tableau / DBeaver / Superset / Power BI / psql / Dremio as a federated Postgres source, OBSL/SPARQL, OSI v0.2 interop with bidirectional schema validation, AI integrations (LangChain, CrewAI, ADK, etc.), model inheritance & extends, data types & numerical precision, timezone settings, grain & filter context overrides, Trend Analysis — partitioned rolling windows, MetricType.WINDOW for rank/lag/lead/ntile, 9 statistical aggregates (CORR, COVAR_, REGR_, STDDEV_, VAR_), Unified authentication (v2.12.0) across REST / Flight / pgwire / UI — AUTH_MODE=api_key with shared key store, pgwire SCRAM-SHA-256 + cleartext, Artefacts Composability Resolution (ACR, v2.14.0): a composables endpoint that, given the query so far, returns which dimensions / measures / metrics can still be added (including CFL candidates), powering guided query building
PlannedOIDC / SSO authentication & per-token authorization scopes, CLI for automation & CI/CD, DDL view generation (CREATE VIEW from queries), additional dialects, additional BI tool integrations, pre-aggregation / materialization layer

Commercial Offerings

OrionBelt Semantic Layer is source-available under BUSL-1.1 until its Apache-2.0 conversion — the free distribution has full parity on the shipped v2.6 surface and is production-grade for self-hosted use. For teams that want production support, a managed runtime, or embedded analytics terms, RALFORION offers:

  • Embedded analytics license — relicensing terms for shipping OBSL inside a commercial product
  • Commercial cloud offering — managed OrionBelt runtime with SLAs
  • Enterprise features — capabilities tailored for enterprise deployments
  • Consulting + support — implementation, modeling, and production support

Contact RALFORION d.o.o. for details.


Companion Project

OrionBelt Analytics

An ontology-based MCP server that analyzes relational database schemas and generates RDF/OWL ontologies. Together with OrionBelt Semantic Layer, it enables AI assistants to navigate your data landscape through ontologies and compile safe, dialect-aware analytical SQL.


Development

Contributing to OrionBelt or running from source:

bash
git clone https://github.com/ralforion/orionbelt-semantic-layer.git
cd orionbelt-semantic-layer
uv sync                           # install all deps (dev, docs, ui, flight, drivers)
uv run orionbelt-api              # start API on :8000
bash
# Quality
uv run pytest                     # run tests
uv run ruff check src/            # lint
uv run ruff format src/ tests/    # format
uv run mypy src/                  # type check

# Docs
uv sync --extra docs && uv run mkdocs serve  # docs on :8080

# CI workflows
./scripts/check-action-pins.sh              # verify every Action pin
./scripts/check-action-pins.sh --offline    # skip the upstream tag lookups

GitHub Actions pinning

Every uses: in .github/workflows is pinned to a 40-character commit SHA rather than a tag, because a tag such as v7 is a movable label: it runs whichever commit its owner has pointed it at when the job starts. The # vX.Y.Z comment beside each SHA names the exact patch release that SHA was cut from, and it has to be a patch release, since a major tag moves with every upstream bump.

Pinning fixes which code runs but makes the reference unreadable, so scripts/check-action-pins.sh keeps the SHA and its comment honest. It walks every uses: line and requires a commit SHA, an owner from its ALLOWED_OWNERS allowlist, and an exact-patch version comment, then resolves that tag upstream with git ls-remote and fails when the commit it names is not the one pinned. Container actions must be pinned by digest; local ./ actions are skipped. --offline checks only the SHA and comment format, with no network calls.

The check runs as the pins job in CI, and as the first step after checkout in the workflows that publish (Docker, PyPI, docs), so a tag can never ship artifacts built by steps whose pins were never verified. Adding an owner to ALLOWED_OWNERS is a deliberate decision: a SHA matching its own tag says nothing about whether that action belongs in this repo at all.


License

Copyright © 2026 RALFORION d.o.o.

OrionBelt® is a registered trademark of RALFORION d.o.o.

Licensed under the Business Source License 1.1 (SPDX: BUSL-1.1). The Licensed Work will convert to Apache License 2.0 on 2030-03-16.

Third-party works redistributed by OrionBelt, and their terms, are listed in THIRD_PARTY_NOTICES.md.

By contributing to this project, you agree to the Contributor License Agreement.

For commercial licensing inquiries, contact: licensing@ralforion.com


将 OrionBelt Semantic Layer MCP 与多个 AI 模型配合使用

TypingMind 在工作区级别连接 MCP 工具,因此连接 OrionBelt Semantic Layer 后,您就可以在 TypingMind 中搭配不同的 AI 模型使用,无需为每个模型单独设置。 此 MCP 通过您设备上的 TypingMind MCP 连接器在本地运行。

本地连接器设置指南

如果 MCP 服务器需要访问您电脑上的本地文件、应用或私有资源,请选择此方式。

1

打开 MCP 设置

在 TypingMind 中,依次前往“设置”、“高级设置”和“模型上下文协议”,然后选择“设置连接器”。

  1. 在您的浏览器中打开 TypingMind。
  2. 点击“设置”图标。
  3. 进入“高级设置”。
  4. 打开“模型上下文协议”部分。
  5. 点击“设置连接器”,然后选择“此设备”。
TypingMind MCP 连接器设置界面,已选择“此设备”
2

运行连接器命令

选择“此设备”,从 TypingMind 复制命令并在终端中运行。使用 MCP 时,请保持该进程运行。

  1. 复制 TypingMind 显示的设置命令。
  2. 在 macOS 上打开“终端”,或在 Windows 上打开 Windows Terminal。
  3. 粘贴并运行命令。
  4. 如果终端询问您是否继续,请确认安装软件包。
  5. 使用 MCP 工具时,请勿关闭终端窗口或停止其中的连接器进程。
3

将 OrionBelt Semantic Layer 添加为服务器

当连接器状态为“就绪”时,点击“编辑服务器”,然后粘贴 MCP 服务器配置。

  1. 等待连接器状态显示为“就绪”。
  2. 点击“编辑服务器”。
  3. 粘贴 OrionBelt Semantic Layer MCP 服务器配置。
  4. 保存服务器列表。
  5. 如需确认连接器是否仍处于就绪状态,请刷新。
TypingMind MCP 设置界面,显示正在运行的服务器和“编辑服务器”按钮
{
  "mcpServers": {
    "orionbelt-semantic-layer": {
      "command": "npx",
      "args": [
        "-y",
        "<mcp-server-package>"
      ]
    }
  }
}
4

在不同模型中使用同一连接

保存服务器列表,打开“插件”,启用 OrionBelt Semantic Layer MCP 工具,然后在 TypingMind 中选择任意受支持的 AI 模型,即可在聊天中使用这些工具,或将其分配给智能体。

  1. 在 TypingMind 中打开“插件”页面。
  2. 启用 OrionBelt Semantic Layer MCP 工具。
  3. 开始聊天并选择您想使用的 AI 模型。
  4. 在聊天中使用 MCP 工具,或将其分配给 AI 智能体。
  5. 根据需要随时切换到其他 AI 模型,无需重新连接 MCP。
在 TypingMind 聊天中使用已启用的 MCP 工具和选定的 AI 模型
您能使用 OrionBelt Semantic Layer 帮我完成这项任务吗?
OrionBelt Semantic Layer
当然,我看过了。
以下是我使用 OrionBelt Semantic Layer 得到的结果。

常见问题

OrionBelt Semantic Layer MCP 服务器有什么用途?

OrionBelt Semantic Layer 是一个 MCP 服务器,可让兼容的 AI 客户端连接外部工具并获取上下文。在 TypingMind 中,只需添加一次此 MCP 服务器,即可在您的 AI 工作区中使用其工具。

可以在 TypingMind 中让多个 AI 模型使用 OrionBelt Semantic Layer MCP 吗?

可以。TypingMind 在工作区层面连接 MCP 工具,因此您无需为每个模型单独配置 MCP 服务器,就能在 Claude、ChatGPT、Gemini 或您在 TypingMind 中配置的其他 AI 模型中使用 OrionBelt Semantic Layer。

为什么在 TypingMind 中使用 OrionBelt Semantic Layer MCP?

TypingMind 将多个 AI 模型、提示词、插件、AI 智能体、API 密钥和 MCP 工具整合到同一个工作区中,是最出色的大语言模型聊天前端之一。连接 OrionBelt Semantic Layer 后,您可以在偏好的不同模型中使用其 MCP 工具,同时在 TypingMind 中井然有序地管理聊天工作流程。

如何将 OrionBelt Semantic Layer MCP 连接到 TypingMind?

OrionBelt Semantic Layer 通过 TypingMind 本地 MCP 连接器运行。当 MCP 服务器需要访问您计算机上的本地文件、桌面应用、命令行工具或私有资源时,这种方式最合适。

OrionBelt Semantic Layer MCP 在 TypingMind 中提供哪些工具?

OrionBelt Semantic Layer 提供 MCP 功能,您可以在 TypingMind 的插件页面启用这些功能,然后在聊天中使用,或将其分配给 AI 智能体。

使用 OrionBelt Semantic Layer MCP 需要向 TypingMind 提供我的 API 密钥吗?

不需要。TypingMind 采用本地优先的设计,让您自行选择模型提供商,并自行管理 API 密钥、提示词和 MCP 配置。如果 OrionBelt Semantic Layer 需要身份验证,请在创建连接时,为该 MCP 服务器添加所需的请求头、OAuth 设置或本地配置。

相关 MCP 服务器

查看全部

立即创建您自己的 AI 工作区

订阅我们的电子简报,获取新功能和后续赠奖活动的通知 👇