sql processor
Runs an arbitrary SQL query against a database and (optionally) returns the result as an array of objects, one for each row returned.
This component is deprecated and may be removed in a future release. Prefer a supported alternative where available.
- Common
- Advanced
# Common config fields, showing default values
pipeline:
processors:
- label: ""
sql:
driver: "" # No default (required)
data_source_name: "" # No default (required)
query: "" # No default (required)
args_mapping: "" # No default (optional)
result_codec: "none"
# All config fields, showing default values
pipeline:
processors:
- label: ""
sql:
driver: "" # No default (required)
data_source_name: "" # No default (required)
query: "" # No default (required)
unsafe_dynamic_query: false
args_mapping: "" # No default (optional)
result_codec: "none"
If the query fails to execute, the message remains unchanged and the error can be caught using error handling methods.
Alternatives
For basic inserts or select queries use either the sql_insert or the sql_select processor. For more complex queries use the sql_raw processor.
Fields
driver
The database driver to use.
Type: string
Options: mysql, postgres, pgx, clickhouse, mssql, sqlite, oracle, snowflake, trino, gocosmos, spanner, databricks, hana
data_source_name
Data source name.
Type: string
query
The query to execute.
You must include the correct placeholders for the specified database driver. Some drivers use question marks (?), whereas others expect incrementing dollar signs ($1, $2, and so on) or colons (:1, :2, and so on). The following table shows the placeholder style for each driver:
|=== | Driver | Placeholder style
| clickhouse
| Dollar sign ($)
| gocosmos
| Colon (:)
| hana
| Question mark (?)
| mssql
| Question mark (?)
| mysql
| Question mark (?)
| oracle
| Colon (:)
| pgx
| Dollar sign ($)
| postgres
| Dollar sign ($)
| snowflake
| Question mark (?)
| spanner
| Question mark (?)
| sqlite
| Question mark (?)
| trino
| Question mark (?)
|===
Type: string
unsafe_dynamic_query
Whether to enable interpolation functions in the query. Make sure your queries are defended against injection attacks.
Type: bool
Default: false
args_mapping
An optional Bloblang mapping that includes the same number of values in an array as the placeholder arguments in the query field.
Type: string
result_codec
Result codec.
Type: string
Default: "none"