Skip to content

API Reference parrot.semantic.governance.lineage

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

parrot.semantic.governance.lineage

View source

Column-usage lineage: projection rights are distinct from usage rights.

Class ColumnUse

One physical column use and the SQL context that consumes it.

Fields:

Field Type Default Description
column str
table str
context Literal['projection', 'where', 'having', 'join', 'group_by', 'order_by', 'window', 'derived']

Alias ModelPolicy

Re-exported from parrot.semantic.policy.ModelPolicy.

Alias PhysicalSchema

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

Alias SemanticAccessError

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

Function enforce_usage_rights

Deny non-projection physical-column use without an explicit grant.

trusted_nodes is intentionally not interpreted as caller-controlled column labels. The pipeline resolves usage before its own RLS and masking nodes are injected, and retains strong references to those nodes for later passes.

enforce_usage_rights(uses: list[ColumnUse], policy: ModelPolicy, roles: frozenset[str], *, trusted_nodes: set[int]) -> None

Parameter Type Default Description
uses list[ColumnUse] Resolved physical column uses from the unmodified query.
policy ModelPolicy Model governance policy.
roles frozenset[str] Trusted roles from the permission context.
trusted_nodes set[int] Pipeline-owned AST identities; never column names.

Raises:

  • SemanticAccessError — If a non-projection use lacks permission.

Function resolve_column_uses

Resolve aliases, CTEs, subqueries, and expressions to physical columns.

resolve_column_uses(tree: exp.Expression, schema: PhysicalSchema) -> list[ColumnUse]

Parameter Type Default Description
tree exp.Expression A qualified sqlglot query AST.
schema PhysicalSchema Model-owned physical schema map.

Returns: list[ColumnUse] — Deterministic, de-duplicated physical column uses.

Raises:

  • SemanticAccessError — If any column cannot be traced safely.

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