個人 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