Updated on 2023-12-14 GMT+08:00

Updating a SQL template

Function

This API is used to update an SQL 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

Table 2 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 an SQL template. This parameter can be left blank.

group

No

String

SQL template group information.

Response

Table 3 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.