Connectors

Browse docs

Connectors

Tap to expand

Contribute

ConnectorsUpdated 2026-03-18

Database Connector

Index structured records from a database into RetainDB when the source of truth already lives in tables instead of docs or files.

Use the database connector when the content you want to search is already stored in a database table and a docs-oriented connector would just add unnecessary copying.

This is usually the right fit for knowledge-base tables, ticket exports, structured notes, or other rows that already have a clean text column.

Use this connector when

  • you control the database connection
  • the table has a clear text field to index
  • the source should stay close to the operational system it comes from

Create the source

bash
curl -X POST "https://api.retaindb.com/v1/projects/proj_123/sources" \
  -H "Authorization: Bearer $RETAINDB_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "KB Articles",
    "connector_type": "database",
    "config": {
      "dsn": "postgres://user:pass@db.example.com:5432/app",
      "table": "kb_articles",
      "id_column": "id",
      "text_column": "content"
    }
  }'

What matters most in setup

The connector only becomes useful if you choose the right row identity and the right text field.

The most common validation question is not “did the connector run?” It is “did I point it at the table and columns that actually contain the knowledge I care about?”

Start sync and check status

bash
curl -X POST "https://api.retaindb.com/v1/sources/src_123/sync" \
  -H "Authorization: Bearer $RETAINDB_API_KEY"
bash
curl "https://api.retaindb.com/v1/sources/src_123/status" \
  -H "Authorization: Bearer $RETAINDB_API_KEY"

Common mistakes

Choosing the wrong text column

If the indexed column is too short, too noisy, or not actually human-readable content, retrieval quality will suffer even if sync succeeds.

Using a production database connection before validating the mapping

Start with the smallest safe dataset you can test.

Treating schema mismatch as a retrieval issue

If id_column or text_column are wrong, fix the connector mapping before you debug search quality.

Security note

Database connectors deserve stricter handling than public web connectors. Treat the DSN like a secret and scope access narrowly.

Next step

If your source is really an API description rather than table data, use API Spec connector. If you want the dashboard-driven source setup flow, use sources: add, sync, and troubleshoot.

Was this page helpful?

Your feedback helps us prioritize docs improvements weekly.