Creates an asynchronous task for detailed data.
Operation description
Before you begin:
Use the latest version of the Alibaba Cloud or DAS SDK.
When you call DAS operations by using the SDK, set the region to cn-shanghai.
Only database instances with DAS Enterprise Edition enabled support creating batch tasks. For information about the databases and regions supported by each DAS Enterprise Edition version, see DAS editions and supported features.
Rate limit:
The maximum number of concurrent tasks is 10.
Try it now
Test
RAM authorization
|
Action |
Access level |
Resource type |
Condition key |
Dependent action |
|
hdm:CreateSqlLogTask |
create |
*All Resource
|
None | None |
Request parameters
|
Parameter |
Type |
Required |
Description |
Example |
| InstanceId |
string |
No |
The database instance ID. |
pc-2ze8g2am97624**** |
| NodeId |
string |
No |
The node ID. Note
This parameter is applicable only to cluster instances. You can specify this parameter to query the batch task of a specific node. If you do not specify this parameter, the batch task of the primary node is returned by default. |
pi-uf6k5f6g3912i**** |
| Type |
string |
No |
The task type.
Note
For the filter parameters and values supported by Export, see Request parameters description.
|
Export |
| Name |
string |
No |
The task name. |
SQL audit export 1 |
| Filters |
array<object> |
No |
The list of filter conditions. |
|
|
object |
No |
The filter condition. |
||
| Key |
string |
No |
The name of the filter parameter. Note
For the supported filter parameters and values, see Request parameters description. |
KeyWords |
| Value |
string |
No |
The value of the filter parameter. |
select |
| StartTime |
integer |
No |
The start time of the task. Specify the value as a UNIX timestamp. Unit: milliseconds. |
1596177993000 |
| EndTime |
integer |
No |
The end time of the task. Specify the value as a UNIX timestamp. Unit: milliseconds. |
1608888296000 |
| Role |
string |
No |
The node information of the PolarDB-X 2.0 database instance.
|
polarx_cn |
Supported parameters and values for Key:
KeyWords: keywords. Separate multiple keywords with spaces.
LogicalOperator: the logical operator between keywords. Valid values: and or or.
AccountName: the username. You can specify multiple usernames separated by commas. Maximum: 5.
DbName: the database name. You can specify multiple database names separated by commas. Maximum: 5.
HostAddress: the client IP address. You can specify multiple IP addresses separated by commas. Maximum: 5.
MaxConsume: the maximum execution duration. Unit: us.
MinConsume: the minimum execution duration. Unit: us.
MaxScanRows: the maximum number of scanned rows.
MinScanRows: the minimum number of scanned rows.
SqlType: the SQL type. Valid values: select, update, insert, or delete.
State: the execution result. Valid values: 0 (successful) or 1 (failed).
ThreadId: the thread ID.
SortKey: the sort column name. Valid values: ScanRows (scanned rows), UpdateRows (updated rows), Consume (execution duration), ExecuteTime (execution time), ReturnRows (returned rows), LockTime (lock wait time), Frows (rows fetched by PolarDB-X 2.0 compute nodes), Scnt (DN requests from PolarDB-X 2.0 compute nodes), CpuTime (CPU execution time), or PhysicalRead (physical reads).
SortMethod: the sort method. Valid values: DESC (descending) or ASC (ascending). Default value: DESC.
TraceId: the trace ID of the PolarDB-X 2.0 instance.
MinRows: the minimum number of updated rows.
MaxRows: the maximum number of updated rows.
MinScnt: the minimum number of DN requests from PolarDB-X 2.0 compute nodes (CN).
MaxScnt: the maximum number of DN requests from PolarDB-X 2.0 compute nodes (CN).
TrxId: the transaction ID.
Fail: the error code.
SqlId: the SQL ID.
JobId: the asynchronous task ID used to further query the returned results.
Delimiter: the delimiter. Supported values:
|,$#.- Columns: when Type = Export (the task type is export task), specify the export columns separated by spaces. Valid values:
columnDBName: database
columnThreadId: thread ID
columnAccountName: user
columnHostAddress: client IP
columnSqlType: SQL type
columnState: status
columnConsume: execution duration (us)
columnUpdateRows: updated rows
columnScanRows: scanned rows
columnReturnRows: returned rows
columnLockTime: lock wait time
columnLogicRead: logical reads
columnPhysicSyncRead: physical synchronous reads
columnPhysicASyncRead: physical asynchronous reads
columnOriginTime: execution time (us)
columnExecuteTime: execution time (for example, 2024-07-30 11:00:00)
Response elements
|
Element |
Type |
Description |
Example |
|
object |
|||
| Code |
string |
The response code. |
200 |
| Message |
string |
The returned message. Note
If the request is successful, Successful is returned. If the request fails, an error message such as an error code is returned. |
Successful |
| RequestId |
string |
The request ID. |
83D9D59B-057A-54A9-BFF9-CF2B42F05645 |
| Success |
string |
Indicates whether the request is successful.
|
true |
| Data |
object |
The returned data. |
|
| TaskId |
string |
The task ID. |
54f8041743ca3a9ac5cb9342d050527c |
| InstanceId |
string |
The database instance ID. |
pc-2ze8g2am97624**** |
| Name |
string |
The task name. |
Export_test |
| Start |
integer |
The start time. Specify the value as a UNIX timestamp. Unit: milliseconds. |
1596177993000 |
| End |
integer |
The end time. Specify the value as a UNIX timestamp. Unit: milliseconds. |
1608888296000 |
| Status |
string |
The task status.
Note
When the task is in the COMPLETED state, you can view the task results. |
COMPLETED |
| CreateTime |
integer |
The task creation time. Specify the value as a UNIX timestamp. Unit: milliseconds. |
1681363254423 |
Examples
Success response
JSON format
{
"Code": "200",
"Message": "Successful",
"RequestId": "83D9D59B-057A-54A9-BFF9-CF2B42F05645",
"Success": "true",
"Data": {
"TaskId": "54f8041743ca3a9ac5cb9342d050527c",
"InstanceId": "pc-2ze8g2am97624****",
"Name": "Export_test",
"Start": 1596177993000,
"End": 1608888296000,
"Status": "COMPLETED",
"CreateTime": 1681363254423
}
}
Error codes
|
HTTP status code |
Error code |
Error message |
Description |
|---|---|---|---|
| 400 | InvalidParams | The request parameters are invalid. | The request parameters are invalid. |
| 403 | NoPermission | You are not authorized to do this action. | You do not have the permissions to perform this operation. |
See Error Codes for a complete list.
Release notes
See Release Notes for a complete list.