Query SQL Execution Logs
Use this API to query NineData SQL execution logs with pagination. Filter by account, time range, data source, database object, SQL type, or SQL statement text.
Request URL: /openapi/v1/actionSQL/list
Request Method: GET
Request Parameters
| Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
| accountId | String | No | Account ID. Call the List Account Information interface to obtain accountId. | 170**********159 |
| startTime | DateTime | No | Operation time range - start time. | 2025-07-31T09:12:30Z |
| endTime | DateTime | No | Operation time range - end time. | 2025-07-31T10:12:30Z |
| module | String | No | Module. Optional values:
| dataExport |
| sqlType | String | No | SQL type, optional values: SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, ALTER, TRUNCATE, CALL, EXECUTE, GRANT, REVOKE, OPTIMIZE, OTHER | SELECT |
| datasourceId | String | No | Data source ID. | ds-123456 |
| databaseName | String | No | Database name. | test_db |
| tableName | String | No | Table name. | user_table |
| sql | String | No | SQL statement. | SELECT * FROM user_table |
| current | Integer | No | Current page number, starting from 1, default is 1. | 1 |
| pageSize | Integer | No | Page size, default is 10. | 10 |
Return Parameters
| Parameter | Type | Description | Example |
|---|---|---|---|
| data | Array | SQL execution log list. Each record includes these fields:
| { "eventTime": "2025-08-04 09:08:11Z", "accountId": "1327052894132866", "accountName": "NineData", "module": "sqlWindow", "type": "execute", "sqlType": "GRANT", "datasourceId": "ds-d59tvhis5v0z", "sql": "grant select on YQ2.* to YQ;", "status": "failed", "affectedRows": 0, "sensitiveColumns": "", "elaspedTime": 498.0, "tables": [] } |
| current | Integer | Current page number. | 1 |
| pageSize | Integer | Page size. | 10 |
| total | Integer | Total number of records. | 1 |
Successful Invocation Example
{
"success": true,
"requestId": "Vs4k0DPF-BHFEaIXnCJJz1OJdBGu9FSY",
"data": [{
"eventTime": "2025-08-04 09:08:11Z",
"accountId": "1327052894132866",
"accountName": "NineData",
"module": "sqlWindow",
"type": "execute",
"sqlType": "GRANT",
"datasourceId": "ds-d59tvhis5v0z",
"sql": "grant select on YQ2.* to YQ;",
"status": "failed",
"affectedRows": 0,
"sensitiveColumns": "",
"elaspedTime": 498.0,
"tables": []
}],
"current": 1,
"pageSize": 10,
"total": 1
}
Result
A successful response returns SQL execution events that match the filters. Use the returned status, affected rows, elapsed time, and object metadata for audit or troubleshooting workflows.