Updated on 2023-11-27 GMT+08:00

Viewing All SQL Templates

Function

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

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

None

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.

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

Name of an SQL template

sql

String

SQL template text

description

String

Description of an 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.