Skip to content

API Reference parrot.handlers.models.recipes

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

parrot.handlers.models.recipes

View source

PgRecipeStore — relational AbstractRecipeStore beside PgUISurfaceStore (FEAT-528).

Mirrors :class:parrot.handlers.models.ui_surfaces.PgUISurfaceStore's shape line for line: same AsyncDB("pg", dsn=...) per-call idiom, same lazy _ensure_ready() / ensure_schema() pattern, same navigator schema default. One row per recipe, keyed by (name, owner) (owner = '' means unscoped/shared), so a recipe becomes editable, backed-up, queryable data alongside the surfaces it produces.

title/description are denormalised columns written on every save so list() never has to deserialise the full recipe JSONB payload.

Alias AbstractRecipeStore

Re-exported from parrot.outputs.a2ui.recipes.store.AbstractRecipeStore.

Alias InfographicRecipe

Re-exported from parrot.outputs.a2ui.recipes.models.InfographicRecipe.

Class PgRecipeStore

Postgres store for :class:InfographicRecipe rows.

Parameter Type Default Description
dsn str | None None Optional connection string; defaults to :data:parrot.conf.default_dsn, same as :class:PgUISurfaceStore.
schema str 'navigator' Target schema (default "navigator"). Validated eagerly against a safe-identifier allowlist — unlike :class:PgUISurfaceStore, which hardcodes navigator, this store takes an explicit schema= keyword (spec §6).

Method PgRecipeStore.ensure_schema

Create <schema>.infographic_recipes if missing.

Idempotent — CREATE ... IF NOT EXISTS everywhere. Tolerates duplicate-object races under concurrent first-callers, mirroring :meth:PgUISurfaceStore.ensure_schema.

ensure_schema() -> None

Method PgRecipeStore.save

Upsert recipe on (name, owner), bumping updated_at.

save(recipe: InfographicRecipe) -> None

Parameter Type Default Description
recipe InfographicRecipe

Method PgRecipeStore.get

Load a recipe by name (and owner scope).

get(name: str, owner: Optional[str] = None) -> InfographicRecipe

Parameter Type Default Description
name str
owner Optional[str] None

Returns: InfographicRecipe

Raises:

  • RecipeNotFoundError — If no such recipe exists.
  • RecipeSchemaVersionError — If the stored schema_version is unsupported.

Method PgRecipeStore.list

List lightweight summaries from the denormalised columns only.

list(owner: Optional[str] = None) -> list[dict[str, Any]]

Parameter Type Default Description
owner Optional[str] None

Returns: list[dict[str, Any]]

Method PgRecipeStore.delete

Delete a recipe by name (and owner scope).

delete(name: str, owner: Optional[str] = None) -> None

Parameter Type Default Description
name str
owner Optional[str] None

Raises:

  • RecipeNotFoundError — If no such recipe exists.

Alias RecipeNotFoundError

Re-exported from parrot.outputs.a2ui.recipes.store.RecipeNotFoundError.

Alias default_dsn

Re-exported from parrot.conf.default_dsn.

Attribute logger

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