DescribeSqlPatternCompareReports

Updated at:
Copy as MD

Queries the list of SQL Pattern comparison reports.

Operation description

Queries the SQL Pattern comparison reports created by the current Alibaba Cloud account for a specified instance. RAM users can query reports that belong to their parent Alibaba Cloud account.

The following pagination methods are supported:

  • Page number-based pagination (recommended): Use PageNumber and PageSize.

  • Token-based pagination: Use MaxResults and NextToken.

Note
  • The two pagination methods cannot be used together. When you use page number-based pagination, the MaxResults parameter that is automatically included by the platform does not take effect.

  • The list returns only unexpired reports in the PENDING, RUNNING, or SUCCESS state.

  • Use DetailEnabled to determine whether report details can be queried. Use CancelAvailable to determine whether a report can be canceled.

  • Reports are valid for 7 days and are isolated by instance and Alibaba Cloud account.

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

No authorization for this operation. If you encounter issues with this operation, contact technical support.

Request parameters

Parameter

Type

Required

Description

Example

RegionId

string

Yes

The region ID of the instance.

cn-beijing

DBClusterId

string

Yes

The ID of the AnalyticDB for MySQL instance.

am-2ze1234567890****

PageNumber

integer

No

The page number. Pages start from 1.

Default value: 1.

Note

Use this parameter together with PageSize. If you specify this parameter, NextToken must be empty.

2

PageSize

integer

No

The number of rows per page. Valid values: 1 to 100.

Default value: 50.

Note

Use this parameter together with PageNumber. If you specify this parameter, NextToken must be empty.

50

MaxResults

integer

No

The number of rows per page for token-based pagination. Valid values: 1 to 100.

Default value: 50.

Note
  • When you use NextToken for pagination, keep this parameter unchanged.

  • This parameter does not take effect when you use PageNumber and PageSize for pagination.

  • We recommend that you use PageNumber and PageSize for pagination.

50

NextToken

string

No

The token for the next page.

Note
  • Do not specify this parameter for the first query. For subsequent queries, pass in the NextToken value returned by the previous query.

  • Do not use this parameter together with PageNumber or PageSize.

  • Use PageNumber and PageSize for pagination.

djE6Mjo1MA

Order

string

No

Sorts the query results by a specified field. The value is a JSON array string, for example, [{"Field":"CreatedAt","Type":"Desc"}]. The array can contain only one object. Fields:

  • Field: the field by which to sort. Valid values:
    • CreatedAt: the time when the report was created.

    • StartTime: the start time of time range 1.

    • CompareStartTime: the start time of time range 2.

  • Type: the sort order. This value is case-insensitive. Valid values:
    • Asc: ascending order.

    • Desc: descending order.

Note

If you do not specify this parameter, the results are sorted by CreatedAt in descending order by default.

[{"Field":"CreatedAt","Type":"Desc"}]

Response elements

Element

Type

Description

Example

object

The paging results of the report list.

Items

array<object>

The list of reports on the current page. An empty array is returned if no reports match the conditions.

object

A single SQL Pattern comparison report.

CancelAvailable

boolean

Indicates whether the report can be canceled. The value is true when the report is in the PENDING or RUNNING state.

false

CompareEndTime

string

The end time of time range 2. The time is in the yyyy-MM-ddTHH:mmZ UTC format.

2026-09-08T01:00Z

CompareStartTime

string

The start time of time range 2. The time is in the yyyy-MM-ddTHH:mmZ UTC format.

2026-09-08T00:00Z

CreatedAt

string

The time when the report was created. The time is in the yyyy-MM-ddTHH:mmZ UTC format.

2026-09-08T01:05Z

DetailEnabled

boolean

Indicates whether report details can be queried. The value is true when the report is in the SUCCESS state.

true

EndTime

string

The end time of time range 1. The time is in the yyyy-MM-ddTHH:mmZ UTC format.

2026-09-07T01:00Z

ReportId

integer

The ID of the SQL Pattern comparison report.

1001

ReportType

string

The report type. Valid values:

  • NEW: new patterns.

  • CHANGED: patterns with increased metrics.

Valid values:

  • NEW :

    New SQL patterns.

  • CHANGED :

    SQL patterns with increased metrics.

CHANGED

ReportTypeName

string

The name of the report type.

Changed Pattern Comparison Report

RowNumber

integer

The sequence number in the current sorted result. The value starts from 1.

1

StartTime

string

The start time of time range 1. The time is in the yyyy-MM-ddTHH:mmZ UTC format.

2026-09-07T00:00Z

Status

string

The report status. Valid values:

  • PENDING: waiting to be generated.

  • RUNNING: being generated.

  • SUCCESS: generated.

  • FAILED: failed to be generated.

  • CANCELED: canceled.

  • EXPIRED: expired.

Note

The current list returns only reports in the PENDING, RUNNING, or SUCCESS state.

Valid values:

  • SUCCESS :

    Generated.

  • FAILED :

    Failed to be generated.

  • RUNNING :

    Being generated.

  • CANCELED :

    Canceled.

  • EXPIRED :

    Expired.

  • PENDING :

    Waiting to be generated.

SUCCESS

MaxResults

integer

The number of rows per page used in this query.

50

NextToken

string

The token for the next page. An empty value indicates that no more pages are available.

djE6Mjo1MA

PageNumber

integer

The page number used in this query. Pages start from 1.

2

PageSize

integer

The number of rows per page used in this query.

50

RequestId

string

The request ID.

9A1B2C3D-4E5F-6789-ABCD-0123456789AB

TotalCount

integer

The total number of reports that match the conditions.

51

Examples

Success response

JSON format

{
  "Items": [
    {
      "CancelAvailable": false,
      "CompareEndTime": "2026-09-08T01:00Z",
      "CompareStartTime": "2026-09-08T00:00Z",
      "CreatedAt": "2026-09-08T01:05Z",
      "DetailEnabled": true,
      "EndTime": "2026-09-07T01:00Z",
      "ReportId": 1001,
      "ReportType": "CHANGED",
      "ReportTypeName": "变化 Pattern 对比报告",
      "RowNumber": 1,
      "StartTime": "2026-09-07T00:00Z",
      "Status": "SUCCESS"
    }
  ],
  "MaxResults": 50,
  "NextToken": "djE6Mjo1MA",
  "PageNumber": 2,
  "PageSize": 50,
  "RequestId": "9A1B2C3D-4E5F-6789-ABCD-0123456789AB",
  "TotalCount": 51
}

Error codes

HTTP status code

Error code

Error message

Description

400 IdempotentParameterMismatch The request uses the same client token as a previous, but non-identical request. Do not reuse a client token with different requests, unless the requests are identical.

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.