Skip to content

API Reference parrot.semantic.execution

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

parrot.semantic.execution

View source

Named-connection credential resolution and governed-SQL execution (spec §3 Module 9).

Class ConnectionResolver

Resolve a named connection into a credentials dict from the environment only.

Parameter Type Default Description
env Mapping[str, str] | None None

Method ConnectionResolver.resolve

Defaults for driver overlaid with PARROT_SEMANTIC_CONN__.

resolve(connection: str, driver: str) -> dict[str, Any]

Parameter Type Default Description
connection str Named connection identifier.
driver str Database driver name.

Returns: dict[str, Any] — The credentials dict.

Raises:

  • SemanticExecutionError — no_credentials when nothing resolves.

Alias DatabaseQueryToolkit

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

Class Executor

Run governed SQL through a DatabaseQueryToolkit source.

Parameter Type Default Description
toolkit DatabaseQueryToolkit
resolver ConnectionResolver

Method Executor.run_with_columns

Execute and also return column names (kept even for empty results).

run_with_columns(governed: GovernedQuery, *, connection: str) -> tuple[list[dict], int, bool, int, list[str]]

Parameter Type Default Description
governed GovernedQuery
connection str

Returns: tuple[list[dict], int, bool, int, list[str]] — (rows, row_count, truncated, duration_ms, columns).

Raises:

  • SemanticExecutionError — no_source, no_credentials or execution_failed.

Method Executor.run

Returns (rows, row_count, truncated, duration_ms); DB errors -> SemanticExecutionError.

run(governed: GovernedQuery, *, connection: str) -> tuple[list[dict], int, bool, int]

Parameter Type Default Description
governed GovernedQuery
connection str

Returns: tuple[list[dict], int, bool, int]

Alias GovernedQuery

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

Alias SemanticExecutionError

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

Alias get_default_credentials

Re-exported from parrot.interfaces.database.get_default_credentials.

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