All Products
Search
Document Center

:ExecuteSQLQuery

Last Updated:Jun 28, 2024

Executes an SQL statement to query the resources that can be accessed within the current account.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer.

Authorization information

There is currently no authorization information disclosed in the API.

Request parameters

ParameterTypeRequiredDescriptionExample
ExpressionstringYes

The SQL statement to be executed.

The number of characters in the SQL statement must be less than 2,000.

For more information about the SQL syntax, see Basic SQL syntax.

SELECT * FROM resources LIMIT 100;
ScopestringNo

The search scope.

Set this parameter to the ID of a resource group.

For information about how to obtain the ID of a resource group, see ListResourceGroups .

rg-acfmzawhxxc****

Response parameters

ParameterTypeDescriptionExample
object

The returned result.

RequestIdstring

The request ID.

D696E6EF-3A6D-5770-801E-4982081FE4D0
Columnsobject []

The columns.

Namestring

The name of the column.

resource_id
Typestring

The type of the column.

varchar
Rowsarray

An array of search results.

any

The information about the row.

[ "vsw-xxx" ]

Examples

Sample success responses

JSONformat

{
  "RequestId": "D696E6EF-3A6D-5770-801E-4982081FE4D0",
  "Columns": [
    {
      "Name": "resource_id",
      "Type": "varchar"
    }
  ],
  "Rows": [
    "[\n      \"vsw-xxx\"  \n]"
  ]
}

Error codes

HTTP status codeError codeError messageDescription
409ExceedLimit.ExecuteTimeThe execution time has exceeded the limit. Please check for complex queries or large data volume, and optimize accordingly.The time consumed for the query exceeds the limit. Check and optimize the complexity of or data size in the SQL statement.
409SQLExecuteErrorFailed to execute the SQL statement.Failed to perform the query. Check whether the query statement is correct.
409InvalidSearch.SQLError: %sError: %s
409InvalidParameter.ScopeThe Scope is invalid.The Scope parameter is invalid
409LengthExceedLimit.ExpressionThe length of parameter Expression exceed limit.The length of the query expression exceeds the limit.

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

Change history

Change timeSummary of changesOperation
No change history