Docs

Daita agents / guide

SQLite

Attach a regular SQLite database file and query its cataloged tables through a read-only connection.

#Attach

The path must be absolute and point to an existing regular file:

python
source = await agent.attach_sqlite(
    "/absolute/path/warehouse.sqlite",
    name="Warehouse",
)

Equivalent source-record form:

python
from pathlib import Path
from daita import SQLiteSource
 
source = await agent.attach(
    SQLiteSource(Path("/absolute/path/warehouse.sqlite"), name="Warehouse")
)

Relative paths, path aliases, symlinks, and non-regular files are rejected. Daita opens the database read-only.

#Discovery

SQLite discovery catalogs:

  • tables and columns;
  • declared types and SQLite affinities;
  • primary keys and indexes;
  • foreign-key relationships; and
  • a source revision derived from SQLite schema state.

Discovery does not sample arbitrary business values or mutate the database.

#Ask Questions

python
result = await agent.run(
    "Count completed orders and total their amount",
    source_id=source.id,
)
print(result.final_text)

The model can use catalog tools followed by data_query_sqlite. Queries must reference current catalog resources and pass deterministic validation before the connector executes them.

#Refresh After Schema Changes

python
await agent.refresh_source(source.id)

SQLite query execution checks the current live schema revision against the committed catalog. If structure has changed, refresh the source before retrying.

#Guardrails

  • The SQLite authorizer denies writes and unsafe operations at execution.
  • SQL is parsed and checked against cataloged tables and columns.
  • Exactly one bounded read is executed.
  • Results are limited by rows and UTF-8 bytes.
  • Paths are reopened with containment and file-identity checks.

See Read-only Querying for the shared SQL contract.