Queries the details of 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. You can call the CreateSQLReviewOrder operation to query the ticket ID.

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 of the SQL statement. Valid values:

  • MUST_IMPROVE: The SQL statement must be optimized.
  • POTENTIAL_ISSUE: The SQL statement contains potential issues.
  • SUGGEST_IMPROVE: We recommend that you optimize 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 optimize the indexes.
CheckStatusResult String No check_not_pass

The review status of the SQL statement. Valid values:

  • new: The SQL statement is pending 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 review status of the SQL statement is manually changed to pass.
  • force_not_pass: The review status of the SQL statement is manually changed to fail.
Page Object No

The details about the page to return.

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 obtain the tenant ID.

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 if the request failed.

ErrorMessage String UnknownError

The error message returned if the request failed.

Success Boolean true

Indicates whether the request was successful.

TotalCount Integer 10

The total number of 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 review status of the SQL statement is manually changed to pass.
  • force_not_pass: The review status of the SQL statement is manually changed to fail.
StatusDesc String The SQL statement passed the review.

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 {"POTENTIAL_ISSUE":1,"SUGGEST_IMPROVE":1}

The optimization suggestion of the SQL statement. The value is a JSON string. Valid values:

  • MUST_IMPROVE: The SQL statement must be optimized.
  • POTENTIAL_ISSUE: The SQL statement contains potential issues.
  • SUGGEST_IMPROVE: We recommend that you optimize 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 optimize the 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 by using the key.

SQLName String getByPk

The name of the SQL statement.

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 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>The SQL statement passed the review.</StatusDesc>
        <CheckedTime>2021-06-09 21:07:00</CheckedTime>
        <SqlHash>95adb6e77a0884d9e50232cb8c5c969d</SqlHash>
        <ReviewSummary>{"POTENTIAL_ISSUE":1,"SUGGEST_IMPROVE":1}</ReviewSummary>
        <SQLReviewQueryKey>a57e54ec5433475ea3082d882fdb89c5</SQLReviewQueryKey>
        <SQLName>getByPk</SQLName>
    </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" : "The SQL statement passed the review.",
    "CheckedTime" : "2021-06-09 21:07:00",
    "SqlHash" : "95adb6e77a0884d9e50232cb8c5c969d",
    "ReviewSummary" : "{\"POTENTIAL_ISSUE\":1,\"SUGGEST_IMPROVE\":1}",
    "SQLReviewQueryKey" : "a57e54ec5433475ea3082d882fdb89c5",
    "SQLName" : "getByPk"
  } ]
}

Error codes

For a list of error codes, see Service error codes.