All Products
Search
Document Center

Data Management:ListSQLReviewOriginSQL

Last Updated:Nov 28, 2024

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

Operation description

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

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

The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:

  • Operation: the value that you can use in the Action element to specify the operation on a resource.
  • Access level: the access level of each operation. The levels are read, write, and list.
  • Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
    • The required resource types are displayed in bold characters.
    • If the permissions cannot be granted at the resource level, All Resources is used in the Resource type column of the operation.
  • Condition Key: the condition key that is defined by the cloud service.
  • Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
OperationAccess levelResource typeCondition keyAssociated operation
dms:ListSQLReviewOriginSQLlist
*All Resources
*
    none
none

Request parameters

ParameterTypeRequiredDescriptionExample
OrderIdlongYes

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

123321
OrderActionDetailobjectNo

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

FileIdlongNo

The ID of the file that contains the SQL statements to be reviewed.

123345
SQLReviewResultstringNo

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: 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 indexes for the SQL statement.
MUST_IMPROVE
CheckStatusResultstringNo

The review status of the SQL statement. Valid values:

  • new: The SQL statement was waiting to be reviewed.
  • unknown: The SQL statement cannot 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
PageobjectNo

The pagination information.

PageNumberintegerNo

The page number.

1
PageSizeintegerNo

The number of entries per page.

20
TidlongNo

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

1

Response parameters

ParameterTypeDescriptionExample
object
RequestIdstring

The request ID.

0C1CB646-1DE4-4AD0-B4A4-7D47DD52E931
ErrorCodestring

The error code that is returned.

UnknownError
ErrorMessagestring

The error message that is returned if the request failed.

UnknownError
Successboolean

Indicates whether the request was successful. Valid values: Valid values:

  • true
  • false
true
TotalCountinteger

The number of SQL statements in the file.

10
OriginSQLListarray<object>

The information about the parsed SQL statements.

OriginSQLListobject
SQLIdlong

The ID of the SQL statement.

1111
FileIdlong

The file ID.

123321
FileNamestring

The name of the file.

test.sql
SQLContentstring

The SQL statement in the file.

select id from table_name
CheckStatusstring

The review status of the SQL statement. Valid values:

  • new: The SQL statement was waiting to be reviewed.
  • unknown: The SQL statement cannot 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
StatusDescstring

The description of the review status.

passed the test
CheckedTimestring

The time when the SQL statement was reviewed.

2021-06-09 21:07:00
SqlHashstring

The MD5 hash value that is obtained after the SQL statement is calculated by using a hash algorithm.

95adb6e77a0884d9e50232cb8c5c969d
ReviewSummarystring

The statistics on the optimization suggestions for SQL statements. The value is a JSON string. Valid values:

  • MUST_IMPROVE: The SQL statements must be optimized.
  • POTENTIAL_ISSUE: The SQL statements contain potential issues.
  • SUGGEST_IMPROVE: We recommend that you optimize the SQL statements.
  • 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 indexes for the SQL statements.
{"POTENTIAL_ISSUE":1,"SUGGEST_IMPROVE":1}
SQLReviewQueryKeystring

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

a57e54ec5433475ea3082d882fdb89c5
SQLNamestring

The name of the SQL statement.

getByPk

Examples

Sample success responses

JSONformat

{
  "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 the test",
      "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, visit the Service error codes.

Change history

Change timeSummary of changesOperation
No change history