Updated on 2026-01-08 GMT+08:00

Updating a SQL Template

Function

This API is used to update a SQL template.

Authorization

Each account has all the permissions required to call all APIs, but IAM users must be assigned the required permissions.

  • If you are using role/policy-based authorization, see the required permissions in Introduction.
  • If you are using identity policy-based authorization, the following identity policy-based permissions are required.

    Action

    Access Level

    Resource Type (*: required)

    Condition Key

    Alias

    Dependency

    dli:template:update

    write

    template *

    -

    -

    -

URI

  • URI format

    PUT /v1.0/{project_id}/sqls/{sql_id}

  • Parameter description
    Table 1 URI parameters

    Parameter

    Mandatory

    Type

    Description

    project_id

    Yes

    String

    Project ID, which is used for resource isolation. For details about how to obtain its value, see Obtaining a Project ID.

    sql_id

    Yes

    String

    SQL template ID

Request Parameters

Table 2 Request parameters

Parameter

Mandatory

Type

Description

sql

No

String

Updated SQL template text.

sql_name

No

String

Name of the updated SQL template. The name must be unique in the current project.

description

No

String

Description of a SQL template. This parameter can be left blank.

group

No

String

SQL template group information.

Response Parameters

Table 3 Response parameters

Parameter

Type

Description

is_success

Boolean

Whether the request is successful.

message

String

System prompt. If execution succeeds, the message may be left blank. If the execution fails, the value will be the cause of the failure.

Example Request

Update information about the SQL template, including the SQL statements, template name, template description, and template group information.

{
  "sql": "select * from t1",
  "sql_name": "sql1",
  "description": "use to select t1",
  "group": ""
}

Example Response

{
  "is_success": true,
"message": ""
}

Status Codes

Status Code

Description

200

OK

Error Codes

For details, see Error Codes.