Semolina¶
Semolina: the ORM for your Semantic Layer.
Typed models in Python, supporting IDE autocomplete, and a Django-like fluent query interface for the semantic layer of your data warehouse backend.
Get started in 5 minutes
Install Semolina and write your first query.
Define models
Map Metric and Dimension fields to your warehouse semantic views.
Build queries
Chain .metrics(), .dimensions(), .where(), .order_by(), .limit().
API reference
Auto-generated reference for every public class, function, and field.
Quick example¶
from semolina import (
SemanticView,
Metric,
Dimension,
register,
pool_from_config,
)
class Sales(SemanticView, view="sales"):
revenue = Metric()
country = Dimension()
pool, dialect = pool_from_config() # reads .semolina.toml
register("default", pool, dialect=dialect)
cursor = (
Sales.query()
.metrics(Sales.revenue)
.dimensions(Sales.country)
.limit(10)
.execute()
)
for row in cursor.fetchall_rows():
print(row.country, row.revenue)
Write the query once. Change the type in your .semolina.toml and the
same code runs on Databricks.