Documentation for version v72
SQL
Description
The SQL pipe executes an SQL query to the database and puts the result as an object or an array of objects in $in.sql_query.
Peculiarities:
- If none of the conditions from *params.outs are met, the event will go to outs.success (if one is specified)
Structure
| Field | Type of value | Example | Required | Description |
|---|---|---|---|---|
| id | number | 10 | yes | Pipe's ID |
| type | string | "sql_pipe" | yes | Type of a pipe |
| params | SQLParamsObject | no | Type-specific parameters | |
| outs | OutsObject | no | Pipe's outputs |
| SQLParamsObject | |||||
|---|---|---|---|---|---|
| Fi | Type | Example | Reqiered | Description | |
| connector_id | number | 5 | yes | - | Connector SQL ID |
| map | bool | true | no | false | Flag to return the result as an object rather than an array of objects (the first line is taken) |
| query | string | "SELECT * FROM Test_Table" | yes | - | SQL request |
| connection_timeout | number | 15 | no | PIPE_SQL_CONNECTION_TIMEOUT | Connection timeout in seconds. Overrides PIPE_SQL_CONNECTION_TIMEOUT in the configuration file. |
| query_timeout | numberо | 10 | no | PIPE_SQL_QUERY_TIMEOUT | Request timeout in seconds. Overrides PIPE_SQL_QUERY_TIMEOUT in the configuration file. |
Errors
Error processing template params.query.
- Error while executing SQL query.
Examples
{
"id": 2,
"type": "sql_pipe",
"params": {
"connection_timeout": 10,
"query_timeout": 10,
"query": "SELECT CAST(SEGMENT_LIST_ID AS VARCHAR) AS 'id', SEGMENT_LIST_NAME AS 'name' FROM SEGMENT_LIST",
"connector_id": 2
},
"outs": {
"success": 3,
"error": 5
}
}