个人 GitHub 账号下公开仓库的所有者可以登录并验证所有权,自行管理介绍,无需管理员批准。
登录并生成验证文件,在 30 分钟内将其提交到此仓库的默认分支。其他分支或分叉仓库中的文件无效。然后在下方检查文件,即可无需管理员批准直接管理项目。请保留文件以维持管理权限。
如需登录,将前往登录页面。登录后请回到此处,再次点击所选的验证按钮。
在项目文件夹中运行 /nomorevibe verify,即可验证所有权并自行管理介绍。
一分钟完成验证制作者的介绍仅有上面的一句话。 更多详情请阅读仓库 README。 仓库 README ↗
正在加载完整 README。
查看完整 README ↗[ 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 an engine to talk to your warehouse. An engine owns one connection pool and the dialect for a backend. Build one with create_engine and register it before running any queries:
from semolina import create_engine, register
engine = create_engine(
"default"
) # reads [connections.default] from .semolina.toml
register("default", engine)
Use Model.query() to start building. Chain .metrics() and .dimensions() to select the fields you want, then call .execute():
query = (
Sales.query()
.metrics(Sales.revenue)
.dimensions(Sales.country)
)
.execute() returns a SemolinaCursor. Use it as a context manager so the pooled connection is released when you are done, and call .fetchall_rows() to get Row objects that support both attribute and dict-style access:
with query.execute() as cursor:
for row in cursor.fetchall_rows():
print(row.country, row.revenue) # attribute access
print(row["country"]) # dict-style access
You should see output like:
CA 2000
CA
US 1500
US