Skip to content

API Reference parrot_loaders.database

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

parrot_loaders.database

View source

DatabaseLoader — Load database table rows as RAG Documents via AsyncDB.

Attribute DEFAULT_EXCLUDE_COLUMNS

Class DatabaseLoader

Load rows from a database table as RAG Documents.

Each row becomes a single Document whose page_content is a YAML or JSON representation of the row (minus excluded columns), and whose metadata carries table, schema, row index, source, and driver information.

Example::

loader = DatabaseLoader(table='plans', schema='att')
docs = await loader.load()

loader = DatabaseLoader(
    table='plans',
    schema='att',
    where="plan_name NOT LIKE '%Online Only%'",
    content_format='json',
)
docs = await loader.load()
Parameter Type Default Description
table str Table name (required).
schema str 'public' Database schema. Defaults to 'public'.
driver str 'pg' AsyncDB driver name. Defaults to 'pg' (PostgreSQL).
dsn Optional[str] None Connection DSN string. Defaults to parrot.conf.default_dsn.
params Optional[Dict[str, Any]] None Alternative connection params dict (mutually exclusive with dsn).
where Optional[str] None Optional SQL WHERE clause (without the WHERE keyword).
content_format str 'yaml' Serialization format for page_content. 'yaml' (default) or 'json'.
exclude_columns Optional[List[str]] None Column names to drop from content. Defaults to ['created_at', 'updated_at', 'inserted_at'].
source_type str 'database'
**kwargs {} Passed to AbstractLoader.__init__.

Attributes:

Attribute Type Description
exclude_columns frozenset[str]

Method DatabaseLoader.load

Load documents from the database table.

Overrides the base load() to supply the table reference as source so callers can simply call await loader.load() without arguments.

load(source=None, **kwargs) -> List[Document]

Parameter Type Default Description
source None
**kwargs {}

Returns: List[Document]

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