Zio.View()
DataStudio’s Virtual Views tab runs a view that has been created and saved by a user by its name. It is a place where you can see all the views scattered across multiple repositories at once.
SQL does not come along. The skill only passes the name, and finding and executing it is handled by the server. Since you never hold the query, there’s no room for tampering.
The query is created and edited by a person on the screen. The skill merely calls it by name — when the view changes, the skill stays the same while the result follows.
from zio_ontology import Zio
# 어떤 뷰가 있는지for v in Zio.view.list(): print(v["name"], v["description"], v["columns"])
# 이름으로 불러 돌린다rows = Zio.view("월별 작업집계").fetch().datafor r in rows: print(r["month"], r["work_count"])
# 사람에게 보일 문장을 만들 때 — 이름과 칸은 화면에서 붙인 것이라 박아 두지 않는다info = Zio.view("월별 작업집계").info()print(f"{info['name']}: {[c['label'] for c in info['columns']]}")| Method | Description |
|---|---|
Zio.view.list() |
List of created views: {name, description, category, columns[]}. No SQL is returned—what you need to pick a view are its name and columns. |
Zio.view(name) |
Retrieve a single view. The name is the one that appears on the DataStudio screen. If it does not exist, a LookupError is raised; otherwise the view’s description is returned in a sentence. |
.fetch(limit=None) |
Execute and fetch rows. Each row is a flat dict with column names as keys. If no limit is given, up to 1000 rows are fetched; if the stored query already contains LIMIT, that value is respected. |
.info() |
Description of the view itself: {name, description, category, columns:[{name, label, type}]}. It’s used when constructing a sentence for humans — even if the name on screen changes, the sentence adapts. |
Different from
Section titled “Different from Zio.entity views”Zio.entityviews
Zio.entitydeals with tables and views that actually exist in PostgreSQL’susrschema.Zio.viewhandles virtual views created in the DataStudio interface — they aggregate multiple repositories into a single view, so there isn’t a single physical table for them. The lookup location is also split across screens.
Read‑only
Section titled “Read‑only”If what’s stored is not a query (
SELECT,WITH, etc.), aValueErroris raised. Even if two views share the same name, aValueErroroccurs — choosing arbitrarily would make it impossible to know which one was executed. Please disambiguate names on screen.