A Pythonic ORM for querying data warehouse semantic views (Snowflake, Databricks, DuckDB)
Project description
Semolina
[ Docs ]
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.
pip install semolina
pip install semolina[snowflake]
pip install semolina[databricks]
A model maps to a semantic view in your warehouse.
from semolina import (
SemanticView,
Metric,
Dimension,
)
class Sales(SemanticView, view="sales"):
revenue = Metric()
cost = Metric()
country = Dimension()
region = Dimension()
Semolina needs a connection pool to talk to your warehouse. Register one before running any queries:
from semolina import register, pool_from_config
pool, dialect = pool_from_config() # reads .semolina.toml
register("default", pool, dialect=dialect)
Use Model.query() to start building. Chain .metrics() and .dimensions() to select the fields you want, then call .execute():
cursor = (
Sales.query()
.metrics(Sales.revenue)
.dimensions(Sales.country)
.execute()
)
.execute() returns a SemolinaCursor. Call .fetchall_rows() to get Row objects that support both attribute and dict-style access:
rows = cursor.fetchall_rows()
for row in rows:
print(row.country, row.revenue) # attribute access
print(row["country"]) # dict-style access
You should see output like:
US 1000
US
CA 2000
CA
US 500
US
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file semolina-0.4.0.tar.gz.
File metadata
- Download URL: semolina-0.4.0.tar.gz
- Upload date:
- Size: 51.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e3073589694ad9e7ecc6c5925b705efb4276b0fbd9b468d99f12ef1a9027a006
|
|
| MD5 |
e9467c0369cd050ff484bc0da7d341b8
|
|
| BLAKE2b-256 |
2d38088899bfbcd8f4004abd322a4436ad1e631cd3bd448a277a2838575b92e9
|
Provenance
The following attestation bundles were made for semolina-0.4.0.tar.gz:
Publisher:
release.yml on anentropic/semolina
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
semolina-0.4.0.tar.gz -
Subject digest:
e3073589694ad9e7ecc6c5925b705efb4276b0fbd9b468d99f12ef1a9027a006 - Sigstore transparency entry: 1497299316
- Sigstore integration time:
-
Permalink:
anentropic/semolina@299864a70d84574a0e0ea593e1f09d67d92af6b3 -
Branch / Tag:
refs/tags/v0.4.0 - Owner: https://github.com/anentropic
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@299864a70d84574a0e0ea593e1f09d67d92af6b3 -
Trigger Event:
push
-
Statement type:
File details
Details for the file semolina-0.4.0-py3-none-any.whl.
File metadata
- Download URL: semolina-0.4.0-py3-none-any.whl
- Upload date:
- Size: 67.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f5b9b7fb40df096ca7cd5b58555a2554421662eb426f56f979ce41ef2f7aeb88
|
|
| MD5 |
b9bc0cbaea7a9cb331fef6ae72395b8f
|
|
| BLAKE2b-256 |
20117d592675fd350e96541b91727c7da9b07d8c125b1d6305c4db3da9a42171
|
Provenance
The following attestation bundles were made for semolina-0.4.0-py3-none-any.whl:
Publisher:
release.yml on anentropic/semolina
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
semolina-0.4.0-py3-none-any.whl -
Subject digest:
f5b9b7fb40df096ca7cd5b58555a2554421662eb426f56f979ce41ef2f7aeb88 - Sigstore transparency entry: 1497299441
- Sigstore integration time:
-
Permalink:
anentropic/semolina@299864a70d84574a0e0ea593e1f09d67d92af6b3 -
Branch / Tag:
refs/tags/v0.4.0 - Owner: https://github.com/anentropic
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@299864a70d84574a0e0ea593e1f09d67d92af6b3 -
Trigger Event:
push
-
Statement type: