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

Checking All SQL Templates

Function

This API is used to check all SQL templates saved by a user.

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:list

    list

    template *

    -

    -

    -

URI

  • URI format

    GET /v1.0/{project_id}/sqls

  • Parameter description
    Table 1 URI parameter

    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.

    Table 2 query parameters

    Parameter

    Mandatory

    Type

    Description

    keyword

    No

    String

    Keyword of SQL template names

Request Parameters

None

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.

sql_count

Int

Total number of SQL templates

sqls

Array of Object

SQL template information. For details, see Table 4.

Table 4 sqls parameters

Parameter

Type

Description

sql_id

String

SQL template ID

sql_name

String

SQL template name

sql

String

SQL template text

description

String

Description of a SQL template

owner

String

Creator of the SQL template

group

String

Name of the template group

Example Request

None

Example Response

{
  "is_success": true,
  "message": "",
  "sql_count": 1,
  "sqls": [
    {
      "description": "use to select t1",
      "owner": "tenant1",
      "sql": "select * from t1",
      "sql_id": "1994b029-3f76-4281-9e35-e370cb4ee26d1501998934432",
      "sql_name": "sql1",
      "group": ""
    }
  ]
}

Status Codes

Status Code

Description

200

OK

Error Codes

For details, see Error Codes.