Skip to content

boringdata/boring-semantic-layer

Repository files navigation

Boring Semantic Layer (BSL)

The Boring Semantic Layer (BSL) is a lightweight semantic layer based on Ibis.

Key Features:

  • Lightweight: pip install boring-semantic-layer
  • Ibis-powered: Built on top of Ibis, supporting any database engine that Ibis integrates with (DuckDB, Snowflake, BigQuery, PostgreSQL, and more)
  • MCP-friendly: Perfect for connecting LLMs to structured data sources

Quick Start

pip install 'boring-semantic-layer[examples]'

1. Define your ibis input table

import ibis

# Create a simple in-memory table
flights_tbl = ibis.memtable({
    "origin": ["JFK", "LAX", "JFK", "ORD", "LAX"],
    "carrier": ["AA", "UA", "AA", "UA", "AA"]
})

2. Define a semantic table

from boring_semantic_layer import to_semantic_table
flights = (
    to_semantic_table(flights_tbl, name="flights")
    .with_dimensions(origin=lambda t: t.origin)
    .with_measures(flight_count=lambda t: t.count())
)

3. Query it

result_df = flights.group_by("origin").aggregate("flight_count").execute()

📚 Documentation

→ View the full documentation


This project is a joint effort by xorq-labs and boringdata.

We welcome feedback and contributions!


Freely inspired by the awesome Malloy project. We loved the vision, just took the Python route.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages