Exporting SQL Explorer Data
Function
After SQL Explorer is enabled, you can export the SQL explorer data within a specified period at a time. The data can be obtained by page. This function is available only for paid instances.
URI
GET /v3/{project_id}/instances/{instance_id}/sql-statements
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
project_id |
Yes |
String |
Project ID. To obtain this value, see Obtaining a Project ID. |
instance_id |
Yes |
String |
Instance ID. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
start_at |
Yes |
Long |
Start time in Unix timestamp format, in milliseconds. |
end_at |
Yes |
Long |
End time in Unix timestamp format, in milliseconds. |
limit |
Yes |
Integer |
Number of records on each page. The maximum value is 2,000. |
marker |
No |
String |
Query result marker. When the first page is obtained, no value needs to be assigned to this parameter. When the next page is obtained, the returned value of the first page query result is used. |
datastore_type |
Yes |
String |
Database type, which can be MySQL and TaurusDB |
Request Parameters
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
X-Auth-Token |
Yes |
String |
User token. |
X-Language |
No |
String |
Request language type. Enumerated values:
|
Response Parameters
Status code: 200
Parameter |
Type |
Description |
---|---|---|
statements |
Array of FullSql objects |
Full SQL set. If the set is empty, all SQL statements have been exported. |
next_marker |
String |
Identifier required for obtaining the next page. This parameter is valid only within 3 minutes. |
Parameter |
Type |
Description |
---|---|---|
sql |
String |
SQL statement. |
operate_type |
String |
Operation type. |
status |
String |
Status. |
error_no |
String |
Error code. |
database |
String |
Database name. |
client |
String |
Client. |
thread_id |
String |
Thread ID. |
user |
String |
User. |
execute_at |
Long |
Execution start time in Unix timestamp format, in milliseconds. |
query_time |
Double |
Duration (ms). |
lock_time |
Double |
Lock wait time (ms). |
rows_examined |
Long |
Scanned rows. |
rows_sent |
Long |
Returned rows. |
rows_affected |
Long |
Number of updated rows. |
Status code: 400
Parameter |
Type |
Description |
---|---|---|
error_code |
String |
Error code. Minimum length: 8 characters Maximum length: 36 characters |
error_msg |
String |
Error message. Minimum length: 2 characters Maximum length: 512 characters |
Status code: 500
Parameter |
Type |
Description |
---|---|---|
error_code |
String |
Error code. Minimum length: 8 characters Maximum length: 36 characters |
error_msg |
String |
Error message. Minimum length: 2 characters Maximum length: 512 characters |
Example Request
Exporting SQL Explorer data
GET https://das.cn-north-1.myhuaweicloud.com/v3/054e292c9880d4992f02c0196d3ea468/instances/da304cd5bbb944de828759bc7be3d3fein01/sql-statements?start_at=1611975464337&end_at=1611979064337&limit=10&marker=DXF1ZXJ5QW5kRmV0Y2gBAAAAAAAQH8YWSEFfM3FyOXZRNzJQOTVLNHNBOTQ2UQ==&datastore_type=MySQL
Example Response
Status code: 200
Response body for exporting all SQL statements
{ "statements" : [ { "sql" : "SELECT 1", "operate_type" : "select", "status" : "success", "error_no" : "", "database" : "", "thread_id" : "11481954", "client" : "100.79.3.154", "user" : "root", "execute_at" : 1612403000100, "query_time" : 0, "lock_time" : 0, "rows_examined" : 0, "rows_sent" : 1, "rows_affected" : 0 } ], "next_marker" : "DXF1ZXJ5QW5kRmV0Y2gBAAAAAAASG3cWcHVpdktBU1lTbjJMM2tmYXYxZ09nUQ==" }
Status Codes
Status Code |
Description |
---|---|
200 |
Response body for exporting all SQL statements. |
400 |
Client error. |
500 |
Server error. |
Error Codes
See Error Codes.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot