🚧 [Experimental] Update SQL query
Updates the specified saved SQL query.
Request
POST
https://api.datalens.tech/rpc/updateSqlQuery
Headers
|
Name |
Description |
|
x-dl-api-version |
Type: string API version header. Const: Example: |
Body
application/json
{
"sqlQueryId": "example",
"description": "example",
"connectionId": "example",
"query": "example",
"params": [
{
"name": "example",
"type": null,
"defaultValue": {}
}
]
}
|
Name |
Description |
||||||||||||||||||
|
connectionId |
Type: string ID of the connection. Supported connection types: PostgreSQL, ClickHouse, MySQL, Greenplum, Trino. Example: |
||||||||||||||||||
|
query |
Type: string Text of the SQL query. Example: |
||||||||||||||||||
|
sqlQueryId |
Type: string ID of the SQL query to update. Example: |
||||||||||||||||||
|
description |
Type: string New description of the SQL query. Example: |
||||||||||||||||||
|
params |
Type: arrayAll of 2 types
Parameters of the SQL query. Example
|
Responses
200 OK
Response
Body
application/json
{
"entry": {
"entryId": "example",
"scope": "sql_query",
"type": "example",
"key": "example",
"workbookId": "example",
"collectionId": "example",
"revId": "example",
"savedId": "example",
"publishedId": "example",
"data": {
"connectionId": "example",
"query": "example",
"statementPositions": [
[
null
]
],
"params": [
{}
]
},
"annotation": {
"description": "example"
},
"createdBy": "example",
"createdAt": "example",
"updatedBy": "example",
"updatedAt": "example",
"revUpdatedBy": "example",
"revUpdatedAt": "example",
"tenantId": "example",
"hidden": true,
"version": 0.5,
"links": {}
}
}
|
Name |
Description |
|
entry |
Type: SqlQuery Example
|
SqlQuery
|
Name |
Description |
||||||||||||||||||||||||||
|
annotation |
Type: object | null Annotation of the SQL query. Example
|
||||||||||||||||||||||||||
|
collectionId |
Type: string | null ID of the collection containing the SQL query. Example: |
||||||||||||||||||||||||||
|
createdAt |
Type: string Date and time when the SQL query was created. Example: |
||||||||||||||||||||||||||
|
createdBy |
Type: string ID of the user who created the SQL query. Example: |
||||||||||||||||||||||||||
|
data |
Type: object
Data of the SQL query entry. Example
|
||||||||||||||||||||||||||
|
entryId |
Type: string Unique identifier of the SQL query. Example: |
||||||||||||||||||||||||||
|
hidden |
Type: boolean Whether the SQL query is hidden. |
||||||||||||||||||||||||||
|
key |
Type: string Key of the SQL query entry. Example: |
||||||||||||||||||||||||||
|
publishedId |
Type: string | null ID of the published SQL query revision. Example: |
||||||||||||||||||||||||||
|
revId |
Type: string ID of the current SQL query revision. Example: |
||||||||||||||||||||||||||
|
savedId |
Type: string ID of the saved SQL query revision. Example: |
||||||||||||||||||||||||||
|
scope |
Type: string Scope of the SQL query entry. Const: Example: |
||||||||||||||||||||||||||
|
tenantId |
Type: string ID of the tenant that owns the SQL query. Example: |
||||||||||||||||||||||||||
|
type |
Type: string Type of the SQL query entry. Example: |
||||||||||||||||||||||||||
|
updatedAt |
Type: string Date and time when the SQL query was last updated. Example: |
||||||||||||||||||||||||||
|
updatedBy |
Type: string ID of the user who last updated the SQL query. Example: |
||||||||||||||||||||||||||
|
version |
Type: number | null Schema version of the SQL query. |
||||||||||||||||||||||||||
|
workbookId |
Type: string ID of the workbook containing the SQL query. Example: |
||||||||||||||||||||||||||
|
links |
Type: object | null Links to the entries the SQL query depends on. Example
|
||||||||||||||||||||||||||
|
revUpdatedAt |
Type: string Date and time when the current revision was last updated. Example: |
||||||||||||||||||||||||||
|
revUpdatedBy |
Type: string ID of the user who last updated the current revision. Example: |
Example
{
"entryId": "example",
"scope": "sql_query",
"type": "example",
"key": "example",
"workbookId": "example",
"collectionId": "example",
"revId": "example",
"savedId": "example",
"publishedId": "example",
"data": {
"connectionId": "example",
"query": "example",
"statementPositions": [
[
null
]
],
"params": [
{
"name": "example"
}
]
},
"annotation": {
"description": "example"
},
"createdBy": "example",
"createdAt": "example",
"updatedBy": "example",
"updatedAt": "example",
"revUpdatedBy": "example",
"revUpdatedAt": "example",
"tenantId": "example",
"hidden": true,
"version": 0.5,
"links": {}
}