All Products
Search
Document Center

Data Management:ListSQLReviewOriginSQL

Last Updated:Aug 28, 2026

Lists SQL statements in an SQL review ticket and returns their review status and optimization suggestions.

Operation description

For more information about the SQL review feature, see SQL review.

Try it now

Try this API in OpenAPI Explorer, no manual signing needed. Successful calls auto-generate SDK code matching your parameters. Download it with built-in credential security for local usage.

Test

RAM authorization

The table below describes the authorization required to call this API. You can define it in a Resource Access Management (RAM) policy. The table's columns are detailed below:

  • Action: The actions can be used in the Action element of RAM permission policy statements to grant permissions to perform the operation.

  • API: The API that you can call to perform the action.

  • Access level: The predefined level of access granted for each API. Valid values: create, list, get, update, and delete.

  • Resource type: The type of the resource that supports authorization to perform the action. It indicates if the action supports resource-level permission. The specified resource must be compatible with the action. Otherwise, the policy will be ineffective.

    • For APIs with resource-level permissions, required resource types are marked with an asterisk (*). Specify the corresponding Alibaba Cloud Resource Name (ARN) in the Resource element of the policy.

    • For APIs without resource-level permissions, it is shown as All Resources. Use an asterisk (*) in the Resource element of the policy.

  • Condition key: The condition keys defined by the service. The key allows for granular control, applying to either actions alone or actions associated with specific resources. In addition to service-specific condition keys, Alibaba Cloud provides a set of common condition keys applicable across all RAM-supported services.

  • Dependent action: The dependent actions required to run the action. To complete the action, the RAM user or the RAM role must have the permissions to perform all dependent actions.

Action

Access level

Resource type

Condition key

Dependent action

dms:ListSQLReviewOriginSQL

list

*All Resource

*

None None

Request parameters

Parameter

Type

Required

Description

Example

OrderId

integer

Yes

The SQL review ticket ID. You can call the CreateSQLReviewOrder operation to obtain this ID.

903****

OrderActionDetail

object

No

The filter criteria for SQL statements in the ticket.

FileId

integer

No

The ID of the file that contains the SQL statements to review.

85****

SQLReviewResult

string

No

The optimization suggestion for the SQL statement. Valid values:

  • MUST_IMPROVE: The SQL statement must be optimized.

  • POTENTIAL_ISSUE: The SQL statement contains potential issues.

  • SUGGEST_IMPROVE: Optimization is recommended for the SQL statement.

  • USE_DMS_TOOLKIT: Lock-free schema changes are recommended.

  • USE_DMS_DML_UNLOCK: Lock-free data changes are recommended.

  • TABLE_INDEX_SUGGEST: Index optimization is recommended for the SQL statement.

MUST_IMPROVE

CheckStatusResult

string

No

The review status of the SQL statement. Valid values:

  • new: The SQL statement is pending review.

  • unknown: The SQL statement could not be parsed.

  • check_not_pass: The SQL statement failed to pass the review.

  • check_pass: The SQL statement passed the review.

  • force_pass: The SQL statement passed the manual review.

  • force_not_pass: The SQL statement failed to pass the manual review.

check_not_pass

Page

object

No

The pagination settings.

PageNumber

integer

No

The page number.

1

PageSize

integer

No

The number of entries per page.

20

Tid

integer

No

The tenant ID. You can call the GetUserActiveTenant or ListUserTenants operation to obtain the tenant ID.

233***

Response elements

Element

Type

Description

Example

object

RequestId

string

The request ID.

0A00863F-6366-5583-9B96-891DC8D8F88A

ErrorCode

string

The error code returned.

UnknownError

ErrorMessage

string

The error message returned if the request failed.

UnknownError

Success

boolean

Indicates whether the request was successful. Valid values:

  • true

  • false

true

TotalCount

integer

The total number of SQL statements in the file.

1

OriginSQLList

array<object>

The parsed SQL statements.

object

SQLId

integer

The ID of the SQL statement.

1111

FileId

integer

The file ID.

858***

FileName

string

The name of the file.

test.sql

SQLContent

string

The content of the SQL statement.

CREATE TABLE `test_sql_review_table` ( `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, `gmt_create` datetime NOT NULL, `name` varchar(256) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

CheckStatus

string

The review status of the SQL statement. Valid values:

  • new: The SQL statement is pending review.

  • unknown: The SQL statement could not be parsed.

  • check_not_pass: The SQL statement failed to pass the review.

  • check_pass: The SQL statement passed the review.

  • force_pass: The SQL statement passed the manual review.

  • force_not_pass: The SQL statement failed to pass the manual review.

check_pass

StatusDesc

string

The description of the review status.

检测通过

CheckedTime

string

The time when the SQL statement was reviewed.

2021-06-09 21:07:00

SqlHash

string

The MD5 hash of the SQL statement.

c7992dc1b681c6733894aded7834f423

ReviewSummary

string

The optimization suggestion statistics for the SQL statements, in JSON format. Valid values:

  • MUST_IMPROVE: The SQL statements must be optimized.

  • POTENTIAL_ISSUE: The SQL statements contain potential issues.

  • SUGGEST_IMPROVE: Optimization is recommended for the SQL statements.

  • USEDMSTOOLKIT: Lock-free schema changes are recommended.

  • USEDMSDML_UNLOCK: Lock-free data changes are recommended.

  • TABLEINDEXSUGGEST: Index optimization is recommended for the SQL statements.

{\"SUGGEST_IMPROVE\":2,\"POTENTIAL_ISSUE\":1}

SQLReviewQueryKey

string

The key for querying optimization suggestion details. You can call the GetSQLReviewOptimizeDetail operation to query details based on this key.

6e9a4bc6867a4174a96b23c8b48b****

SQLName

string

The name of the SQL statement.

getByPk

Examples

Success response

JSON format

{
  "RequestId": "0A00863F-6366-5583-9B96-891DC8D8F88A",
  "ErrorCode": "UnknownError",
  "ErrorMessage": "UnknownError",
  "Success": true,
  "TotalCount": 1,
  "OriginSQLList": [
    {
      "SQLId": 1111,
      "FileId": 0,
      "FileName": "test.sql",
      "SQLContent": "CREATE TABLE `test_sql_review_table` (\n  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,\n  `gmt_create` datetime NOT NULL,\n  `name` varchar(256) DEFAULT NULL\n) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;",
      "CheckStatus": "check_pass",
      "StatusDesc": "检测通过",
      "CheckedTime": "2021-06-09 21:07:00",
      "SqlHash": "c7992dc1b681c6733894aded7834f423",
      "ReviewSummary": "{\\\"SUGGEST_IMPROVE\\\":2,\\\"POTENTIAL_ISSUE\\\":1}",
      "SQLReviewQueryKey": "6e9a4bc6867a4174a96b23c8b48b****",
      "SQLName": "getByPk"
    }
  ]
}

Error codes

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.