Queries the details of the SQL statements that are involved in an SQL review ticket.

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

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request parameters

Parameter Type Required Example Description
Action String Yes ListSQLReviewOriginSQL

The operation that you want to perform. Set the value to ListSQLReviewOriginSQL.

OrderId Long Yes 123321

The ID of the ticket for the SQL review. You can call the CreateSQLReviewOrder operation to query the ID of the ticket.

OrderActionDetail Object No

The parameters that are used to filter SQL statements involved in the ticket.

FileId Long No 123345

The ID of the file.

SQLReviewResult String No MUST_IMPROVE

The optimization suggestion for the SQL statement. Valid values:

  • MUST_IMPROVE: The SQL statement must be improved.
  • POTENTIAL_ISSUE: The SQL statement contains potential issues.
  • SUGGEST_IMPROVE: We recommend that you improve the SQL statement.
  • USE_DMS_TOOLKIT: We recommend that you change schemas without locking tables.
  • USE_DMS_DML_UNLOCK: We recommend that you change data without locking tables.
  • TABLE_INDEX_SUGGEST: We recommend that you use SQL statements that use indexes.
CheckStatusResult String No check_not_pass

The review status of the SQL statement. Valid values:

  • new: The SQL statement is pending for analysis.
  • unknown: The SQL statement failed to be parsed.
  • check_not_pass: The SQL statement failed the review.
  • check_pass: The SQL statement passed the review.
  • force_pass: The SQL statement passed the review by manual effort.
  • force_not_pass: The SQL statement failed the review by manual effort.
Page Object No

The paging settings.

PageNumber Integer No 1

The number of the page to return.

PageSize Integer No 20

The number of entries to return on each page.

Tid Long No 1

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

RegionId String No cn-hangzhou

The ID of the region where DMS is activated. For more information about the valid values of the parameter, see RegionID parameter.

Note Set this parameter to the ID of the region that is close to your service.

Response parameters

Parameter Type Example Description
RequestId String 0C1CB646-1DE4-4AD0-B4A4-7D47DD52E931

The ID of the request.

ErrorCode String UnknownError

The error code returned.

ErrorMessage String UnknownError

The error message returned.

Success Boolean true

Indicates whether the request is successful.

TotalCount Integer 10

The total number of the SQL statements.

OriginSQLList Array of OriginSQLList

The information about the parsed SQL statements.

SQLId Long 1111

The ID of the SQL statement.

FileId Long 123321

The ID of the file.

FileName String test.sql

The name of the file.

SQLContent String select id from table_name

The SQL statement.

CheckStatus String check_pass

The review status of the SQL statement. Valid values:

  • new: The SQL statement is pending for analysis.
  • unknown: The SQL statement failed to be parsed.
  • check_not_pass: The SQL statement failed the review.
  • check_pass: The SQL statement passed the review.
  • force_pass: The SQL statement passed the review by manual effort.
  • force_not_pass: The SQL statement failed the review by manual effort.
StatusDesc String passed

The description of the review status.

CheckedTime String 2021-06-09 21:07:00

The time when the SQL statement is reviewed.

SqlHash String 95adb6e77a0884d9e50232cb8c5c969d

The MD5 hash value of the SQL statement.

ReviewSummary String null

The statistics of optimization suggestions for SQL statements. The value is a JSON string. The following optimization suggestions are involved:

  • MUST_IMPROVE: The SQL statement must be improved.
  • POTENTIAL_ISSUE: The SQL statement contains potential issues.
  • SUGGEST_IMPROVE: We recommend that you improve the SQL statement.
  • USEDMSTOOLKIT: We recommend that you change schemas without locking tables.
  • USEDMSDML_UNLOCK: We recommend that you change data without locking tables.
  • TABLEINDEXSUGGEST: We recommend that you use SQL statements that use indexes.
SQLReviewQueryKey String a57e54ec5433475ea3082d882fdb89c5

The key that is used to query the details of optimization suggestions. You can call the GetSQLReviewOptimizeDetail operation to query the details of optimization suggestions based on the key.

Examples

Sample requests

http(s)://dms-enterprise.aliyuncs.com/?Action=ListSQLReviewOriginSQL
&OrderId=123321
&OrderActionDetail={"FileId":123345,"SQLReviewResult":"MUST_IMPROVE","CheckStatusResult":"check_not_pass","Page":{"PageNumber":1,"PageSize":20}}
&Tid=1
&<Common request parameters>

Sample success responses

XML format

HTTP/1.1 200 OK
Content-Type:application/xml

<ListSQLReviewOriginSQLResponse>
    <RequestId>0C1CB646-1DE4-4AD0-B4A4-7D47DD52E931</RequestId>
    <ErrorCode>UnknownError</ErrorCode>
    <ErrorMessage>UnknownError</ErrorMessage>
    <Success>true</Success>
    <TotalCount>10</TotalCount>
    <OriginSQLList>
        <SQLId>1111</SQLId>
        <FileId>123321</FileId>
        <FileName>test.sql</FileName>
        <SQLContent>select id from table_name</SQLContent>
        <CheckStatus>check_pass</CheckStatus>
        <StatusDesc>passed</StatusDesc>
        <CheckedTime>2021-06-09 21:07:00</CheckedTime>
        <SqlHash>95adb6e77a0884d9e50232cb8c5c969d</SqlHash>
        <ReviewSummary>{"POTENTIAL_ISSUE":1,"SUGGEST_IMPROVE":1}</ReviewSummary>
        <SQLReviewQueryKey>a57e54ec5433475ea3082d882fdb89c5</SQLReviewQueryKey>
    </OriginSQLList>
</ListSQLReviewOriginSQLResponse>

JSON format

HTTP/1.1 200 OK
Content-Type:application/json

{
  "RequestId" : "0C1CB646-1DE4-4AD0-B4A4-7D47DD52E931",
  "ErrorCode" : "UnknownError",
  "ErrorMessage" : "UnknownError",
  "Success" : true,
  "TotalCount" : 10,
  "OriginSQLList" : [ {
    "SQLId" : 1111,
    "FileId" : 123321,
    "FileName" : "test.sql",
    "SQLContent" : "select id from table_name",
    "CheckStatus" : "check_pass",
    "StatusDesc" : "passed",
    "CheckedTime" : "2021-06-09 21:07:00",
    "SqlHash" : "95adb6e77a0884d9e50232cb8c5c969d",
    "ReviewSummary" : "{\"POTENTIAL_ISSUE\":1,\"SUGGEST_IMPROVE\":1}",
    "SQLReviewQueryKey" : "a57e54ec5433475ea3082d882fdb89c5"
  } ]
}

Error codes

For a list of error codes, visit the API Error Center.