🚧 [Experimental] Run SQL query
Runs the specified saved SQL query and returns its result.
Request
POST
https://api.datalens.tech/rpc/runSqlQuery
Headers
|
Name |
Description |
|
x-dl-api-version |
Type: string API version header. Const: Example: |
Body
application/json
{
"sqlQueryId": "example",
"params": {}
}
|
Name |
Description |
||||||
|
sqlQueryId |
Type: string ID of the SQL query to run. Example: |
||||||
|
params |
Type: object
Values of the query parameters, keyed by name. A parameter left out here falls back to its default value. Example
|
Responses
200 OK
Response
Body
application/json
{
"id": "example",
"connectionId": "example",
"tenantId": "example",
"status": "success",
"query": "example",
"statementPositions": [
[
null
]
],
"results": [
{
"status": "success",
"columns": [
{}
],
"rows": [
[
null
]
],
"hasMoreRows": true,
"affectedRows": 0.5
}
],
"createdBy": "example",
"createdAt": "example",
"updatedAt": "example"
}
|
Name |
Description |
||||||||||||||||||||
|
connectionId |
Type: string ID of the connection the query was executed on. Example: |
||||||||||||||||||||
|
createdAt |
Type: string Date and time when the query run was created. Example: |
||||||||||||||||||||
|
createdBy |
Type: string ID of the user who ran the query. Example: |
||||||||||||||||||||
|
id |
Type: string ID of the query run. Example: |
||||||||||||||||||||
|
query |
Type: string Text of the executed query. Example: |
||||||||||||||||||||
|
results |
Type: arrayAny of 2 types
Results of the executed statements, in the order of the statements. Example
|
||||||||||||||||||||
|
statementPositions |
Type: unknown[][] Start and end indexes of the executed statements. Example
|
||||||||||||||||||||
|
status |
Type: string Status of the query run. Enum: |
||||||||||||||||||||
|
tenantId |
Type: string ID of the DataLens tenant. Example: |
||||||||||||||||||||
|
updatedAt |
Type: string Date and time when the query run was updated. Example: |