|
Activity |
SQLQuery |
|---|---|
|
Description |
Execute a Query in a dbstore |
Input :
|
PropertyName |
Rule of use (if revelant) |
Type |
Required |
Default Value |
Description |
|---|---|---|---|---|---|
|
connectionName |
|
STRING |
YES |
|
name of the source connection (see DbStore) |
|
QueryFileToken |
NB: Use one parameter or the other as input (not both at the same time) |
STRING |
YES
|
|
Filetoken containing the query to execute |
|
Query |
STRING |
|
SQL Query to execute |
||
|
Type |
|
STRING |
NO |
NonQuery |
Method of interactions with the database 3 available options
|
|
MaxResults |
|
INT |
NO |
10 |
The JSON to load (must be either a JSON Array or a JSON Object) |
|
Params |
|
PARAMETERS ARRAY |
NO |
|
Query parameters |
|
CommandTimeout |
|
INT |
NO |
|
Mapping between columns and JSON properties |
Parameters
|
PropertyName |
Type |
Required |
Default Value |
Description |
|---|---|---|---|---|
|
Name |
STRING |
YES |
|
name of the parameter |
|
Value |
STRING |
NO |
|
value of the parameter |
Output
|
PropertyName |
Type |
Description |
|---|---|---|
|
Scalar |
ANY |
Scalar value (for Scalar queries) |
|
Result |
DICTIONARY ARRAY |
Reader results |
Example1: Execute Simple query
Input
{
"connectionName": "dbStore1",
"type": "reader",
"query":"SELECT name, role FROM employees"
}
Output
{
"result":[
{"name":"Bob","role":"sales"},
{"name":"Frank","role":"operations"},
{"name":"Ziggy","role":"board"},
{"name":"Julia","role":"sales"},
]
}
Example2: Execute Scalar query
Input
{
"connectionName": "dbStore1",
"type": "scalar",
"query":"SELECT COUNT(*) FROM employees"
}
Output
{
"scalar": 35
}
Example3: Execute query with parameters
Input
{
"connectionName": "dbStore1",
"type": "reader",
"query":"SELECT name FROM employees WHERE name like @likename",
"params":[
{"name":"likename", "value":"B%"}
]
}
Output
{
"result":[
{"name":"Bob"},
{"name":"Bruno"},
{"name":"Brock"},
]
}