Skip to content

API Reference parrot.semantic.catalog

github-actions[bot] edited this page Dec 2, 2026 · 4 revisions

parrot.semantic.catalog

View source

Role-filtered catalog, member-right checks and saved-query expansion (spec §3 Module 7).

Alias FilterGroup

Re-exported from parrot.semantic.models.FilterGroup.

Alias FilterLeaf

Re-exported from parrot.semantic.models.FilterLeaf.

Alias LoadedModel

Re-exported from parrot.semantic.loader.LoadedModel.

Alias ModelMember

Re-exported from parrot.semantic.models.ModelMember.

Class RoleCatalog

Expose only the semantic members a subject's roles are granted.

Parameter Type Default Description
models dict[str, LoadedModel] Loaded model snapshot keyed by model name.

Method RoleCatalog.visible_members

Allowed members only; a governed model with authorized=False exposes nothing (not even names).

Masked members stay visible: masking is applied to projected values downstream, never by hiding the member from a role that was granted it.

visible_members(model: str, roles: frozenset[str], *, authorized: bool) -> list[ModelMember]

Parameter Type Default Description
model str Model name.
roles frozenset[str] Trusted subject roles.
authorized bool Whether the subject is an authenticated, authorized principal.

Returns: list[ModelMember]

Raises:

  • SemanticAccessError — If the model is unknown.

Method RoleCatalog.check_query_rights

Every metric/dimension/time-dimension/filter/order member must be allowed.

Derived metric dependencies and metric filter members are checked as well.

check_query_rights(query: SemanticQuery, roles: frozenset[str]) -> None

Parameter Type Default Description
query SemanticQuery
roles frozenset[str]

Raises:

  • SemanticAccessError — member_not_granted for the first disallowed member, with suggestions drawn only from allowed members.

Method RoleCatalog.expand_saved_query

Replace saved_query with the stored query (same model); unknown name -> SemanticValidationError.

expand_saved_query(query: SemanticQuery) -> SemanticQuery

Parameter Type Default Description
query SemanticQuery

Returns: SemanticQuery

Method RoleCatalog.search

Case-insensitive substring + difflib ranking over visible members and descriptions.

search(text: str, roles: frozenset[str], model: str | None = None, *, authorized: dict[str, bool] | None = None) -> list[dict]

Parameter Type Default Description
text str
roles frozenset[str]
model str | None None
authorized dict[str, bool] | None None

Returns: list[dict]

Alias SemanticAccessError

Re-exported from parrot.semantic.errors.SemanticAccessError.

Alias SemanticQuery

Re-exported from parrot.semantic.models.SemanticQuery.

Alias SemanticValidationError

Re-exported from parrot.semantic.errors.SemanticValidationError.

Architecture

Clients

Bots & Agents

Memory

Knowledge

Tools & Toolkits

Flows

Experts

Skills

Stores & Loaders

MCP & A2A

Server & APIs

Integrations

Outputs & A2UI

Prompts

Security

Operations

Migration

SDD Tooling

LLM Wiki

Deployment

Decisions

API Reference

Clone this wiki locally