Skip to content

Zio.view()

DataStudio’s Virtual Views tab retrieves what a user has created and saved by name. It is the place where you can view multiple dispersed repositories at once.

SQL does not come along. The skill only passes the name, and both finding and executing are handled on the server side. Since you never hold the query, there’s no room for tampering.

Queries are created and edited by people in the UI. The skill merely calls them by name — when a 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().data
for 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 — only name and columns are needed to select a view.
Zio.view(name) Retrieve a single view. The name is the one shown 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}]}. Used when generating sentences for users — even if the name changes on screen, the sentence adapts accordingly.

Zio.entity deals with tables and views that actually exist in PostgreSQL’s usr schema. Zio.view handles virtual views created in the DataStudio UI — they aggregate multiple repositories, so there isn’t a single physical table for them. The lookup location is also split across screens.

If what is stored is not a query (SELECT·WITH), a ValueError is raised. If more than one view shares the same name, a ValueError is also raised — choosing arbitrarily would leave everyone unsure which view was executed. Please disambiguate names in the UI.

(주)지오유 · 경기 용인시 처인구 유림로154번길(유방동 673-2) 20-13

CEO 신달수·Business no. 142-81-36612·E-commerce no. 용인처인-0118호·Privacy officer 신달수·Email shindalsoo@gmail.com·Tel 1833-3623·Fax 02-6918-4006