Skip to main content
SQL Lookup stage showing database enrichment with parameterized queries
The SQL Lookup stage enriches documents by querying external SQL databases. It executes parameterized queries using document fields as inputs, joining external structured data with your search results.
Stage Category: APPLY (Enriches documents)Transformation: N documents → N documents (with SQL data added)

When to Use

When NOT to Use

Parameters

Supported Databases

Configuration Examples

Query Syntax

Parameter Placeholders

Use :name syntax for parameter placeholders:
Parameters are properly escaped to prevent SQL injection.

Template Variables

Output Schema

Single Row (default)

Multiple Rows

No Results

Security

SQL queries are parameterized to prevent injection attacks. Never concatenate user input directly into query strings.

Performance

For high-volume lookups, ensure your database has appropriate indexes on the queried columns. Consider caching frequently accessed data.

Common Pipeline Patterns

Search + SQL Enrichment

Error Handling