All Products
Search
Document Center

Data Management:ExecuteScript

Last Updated:Oct 21, 2024

Executes SQL statements.

Operation description

You can call this operation only for instances that are managed in Security Collaboration mode.

Debugging

You can run this interface directly in OpenAPI Explorer, saving you the trouble of calculating signatures. After running successfully, OpenAPI Explorer can automatically generate SDK code samples.

Authorization information

There is currently no authorization information disclosed in the API.

Request parameters

ParameterTypeRequiredDescriptionExample
DbIdintegerYes

The ID of the database.

Note This parameter is equivalent to the DatabaseId parameter in the SearchDatabase, ListDatabases, and GetDatabase operations. You can call one of these operations to obtain the required database ID. For more information, see SearchDatabase , ListDatabases , and GetDatabase .
123
ScriptstringYes

The SQL statements to be executed. Data query language (DQL) statements, data definition language (DDL) statements, and data manipulation language (DML) statements are supported. The control mode of the instance that you want to query determines whether you can execute DDL and DML statements.

select dt from report_daily
LogicbooleanYes

Specifies whether the database is a logical database.

false
TidlongNo

The ID of the tenant.

Note To obtain the tenant ID, move the pointer over the profile picture in the upper-right corner of the Data Management (DMS) console. For more information, see Tenant information.
234

Response parameters

ParameterTypeDescriptionExample
object
RequestIdstring

The ID of the request.

FE8EE2F1-4880-46BC-A704-5CF63EAF9A04
Resultsarray<object>

The results of the SQL statements that are executed, in the format of an array. Each entry in the array indicates the result of an SQL statement.

Resultobject
ColumnNamesarray

The fields that are queried after the SQL statement is executed.

ColumnNamesstring
col1
Rowsarray<object>

The rows that are queried after the SQL statement is executed.

Rowsobject
[{"col1": "value1", "col2":"value2"}]
Successboolean

Indicates whether the SQL statement is executed.

true
Messagestring

The error message that is returned if the SQL statement fails to be executed. For example, an error message is returned because the SQL statement is invalid.

UnknownError
RowCountlong

The total number of entries that are returned.

1
ErrorCodestring

The error code.

UnknownError
ErrorMessagestring

The error message about the gateway.

UnknownError
Successboolean

Indicates whether the request is successful.

true

Examples

Sample success responses

JSONformat

{
  "RequestId": "FE8EE2F1-4880-46BC-A704-5CF63EAF9A04",
  "Results": [
    {
      "ColumnNames": [
        "col1"
      ],
      "Rows": [
        [
          {
            "col1": "value1",
            "col2": "value2"
          }
        ]
      ],
      "Success": true,
      "Message": "UnknownError",
      "RowCount": 1
    }
  ],
  "ErrorCode": "UnknownError",
  "ErrorMessage": "UnknownError",
  "Success": true
}

Error codes

For a list of error codes, visit the Service error codes.

Change history

Change timeSummary of changesOperation
No change history