Skip to content

API Reference parrot.semantic.toolkit

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

parrot.semantic.toolkit

View source

Governed semantic tools with trusted host-bound request identity.

Alias AbstractToolkit

Re-exported from parrot.tools.toolkit.AbstractToolkit.

Alias CompileCache

Re-exported from parrot.semantic.cache.CompileCache.

Alias ConnectionResolver

Re-exported from parrot.semantic.execution.ConnectionResolver.

Alias DatabaseQueryToolkit

Re-exported from parrot.tools.databasequery.toolkit.DatabaseQueryToolkit.

Alias Executor

Re-exported from parrot.semantic.execution.Executor.

Alias GovernancePipeline

Re-exported from parrot.semantic.governance.pipeline.GovernancePipeline.

Alias GovernedDatasetSink

Re-exported from parrot.semantic.handoff.GovernedDatasetSink.

Alias GovernedQuery

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

Alias GovernedSinkRegistry

Re-exported from parrot.semantic.handoff.GovernedSinkRegistry.

Alias LoadedModel

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

Alias PbacGate

Re-exported from parrot.semantic.governance.pbac.PbacGate.

Alias PhysicalResources

Re-exported from parrot.tools.dataset_manager.sources.resolver.PhysicalResources.

Alias ResultHandle

Re-exported from parrot.semantic.results.ResultHandle.

Alias ResultHandleStore

Re-exported from parrot.semantic.results.ResultHandleStore.

Alias RlsPushdown

Re-exported from parrot.semantic.governance.rls.RlsPushdown.

Alias RlsRegistry

Re-exported from parrot.auth.RlsRegistry.

Alias RlsRule

Re-exported from parrot.auth.RlsRule.

Alias RoleCatalog

Re-exported from parrot.semantic.catalog.RoleCatalog.

Alias SemanticAccessError

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

Alias SemanticAuditEntry

Re-exported from parrot.semantic.audit.SemanticAuditEntry.

Alias SemanticAuditLedger

Re-exported from parrot.semantic.audit.SemanticAuditLedger.

Alias SemanticError

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

Class SemanticLayerToolkit

Catalog, compile and metric query surface over one governance pipeline.

Parameter Type Default Description
**kwargs Any {}

Method SemanticLayerToolkit.list_models

List models whose manifests are authorized for the current subject.

list_models() -> list[dict]

Returns: list[dict]

Method SemanticLayerToolkit.list_metrics

Describe allowed metrics of an authorized model.

list_metrics(model: str) -> list[dict]

Parameter Type Default Description
model str

Returns: list[dict]

Method SemanticLayerToolkit.get_dimensions

Describe allowed dimensions compatible with requested metrics.

get_dimensions(model: str, metrics: list[str] | None = None) -> list[dict]

Parameter Type Default Description
model str
metrics list[str] | None None

Returns: list[dict]

Method SemanticLayerToolkit.get_dimension_values

Query authorized dimension values through the complete governance path.

get_dimension_values(model: str, dimension: str, metrics: list[str] | None = None, limit: int = 50) -> SemanticQueryResult

Parameter Type Default Description
model str
dimension str
metrics list[str] | None None
limit int 50

Returns: SemanticQueryResult

Method SemanticLayerToolkit.search_data_model

Search only members from models authorized for the current subject.

search_data_model(text: str, model: str | None = None) -> list[dict]

Parameter Type Default Description
text str
model str | None None

Returns: list[dict]

Method SemanticLayerToolkit.list_saved_queries

List saved queries whose referenced members are all authorized.

list_saved_queries(model: str) -> list[dict]

Parameter Type Default Description
model str

Returns: list[dict]

Method SemanticLayerToolkit.compile_query

Return audited pre-RLS compiled SQL without database execution; governed SQL stays in the audit.

compile_query(query: SemanticQuery) -> dict

Parameter Type Default Description
query SemanticQuery

Returns: dict

Method SemanticLayerToolkit.query_metrics

Authorize, compile, govern, execute and audit before returning rows.

query_metrics(query: SemanticQuery) -> SemanticQueryResult

Parameter Type Default Description
query SemanticQuery

Returns: SemanticQueryResult

Method SemanticLayerToolkit.reload

Reload complete model snapshots and invalidate their compilation cache entries.

reload() -> None

Method SemanticLayerToolkit.run_sql

Run opt-in SQL through identical governance, provenance and audit checks.

The SQL is authorized against the model manifest, governed by the same pipeline as structured queries (validation, lineage, usage rights, RLS, masking, positive guard, PBAC), every resolved semantic member must be granted, and the call is audited before rows are returned.

run_sql(model: str, sql: str) -> SemanticQueryResult

Parameter Type Default Description
model str Semantic model whose physical schema the SQL addresses.
sql str Caller-supplied read-only SQL.

Returns: SemanticQueryResult — Governed rows, with a retained handle carrying exact physical provenance.

Raises:

  • SemanticAccessError — When raw SQL is disabled or any governance check denies.

Method SemanticLayerToolkit.save_result_as_dataset

Publish an owned result only through a conforming guarded host sink.

The handle is claimed with the trusted identity and the current subject, model and policy versions; every retained member, physical column and table is re-authorized (catalog grants, usage grants, PBAC) before the registered guarded sink publishes it with a read authorizer that rechecks everything again on every downstream exposure.

save_result_as_dataset(result_id: str, name: str, description: str | None = None) -> dict

Parameter Type Default Description
result_id str Opaque handle returned by a previous governed query.
name str Dataset name inside the caller's private sink scope.
description str | None None Optional human description recorded with the publication.

Returns: dict — Publication metadata from the sink plus the audit identifier.

Raises:

  • SemanticResultError — When hand-off is unavailable, the handle cannot be claimed, the sink is rejected, or any re-authorization fails.

Alias SemanticModelLoader

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

Alias SemanticPolicyError

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

Alias SemanticQuery

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

Alias SemanticQueryResult

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

Alias SemanticRequestIdentity

Re-exported from parrot.semantic.context.SemanticRequestIdentity.

Alias SemanticResultError

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

Alias build_read_authorizer

Re-exported from parrot.semantic.handoff.build_read_authorizer.

Alias compile_query_sql

Re-exported from parrot.semantic.engines.compile.

Alias current_identity

Re-exported from parrot.semantic.context.current_identity.

Alias current_pctx

Re-exported from parrot.semantic.context.current_pctx.

Function handle_owner_of

Return the (agent, user, tenant, session) owner tuple of a trusted identity.

handle_owner_of(identity: SemanticRequestIdentity) -> tuple[str, str, str, str]

Parameter Type Default Description
identity SemanticRequestIdentity

Returns: tuple[str, str, str, str]

Alias require_identity

Re-exported from parrot.semantic.context.require_identity.

Alias subject_digest

Re-exported from parrot.semantic.governance.pipeline.subject_digest.

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