Get SQL history overview

Summarize the number of SQL execution records in the current workspace by time range and SQL source. The result only contains the number of each execution status and does not return a single SQL execution record. By default, only records of the current identity are counted. When you have the corresponding permissions, you can count records in the workspace range.

HTTP
POST $CLOUDSIGMA_API_BASE/query/history/overview

Before you call

Configure the CloudSigma regional endpoint and authentication before calling. The endpoint, credentials, workspace, and resource IDs must belong to the same region. Prepare personal access token and current workspace ID with current workspace access rights.

Request body

Replace $CLOUDSIGMA_API_KEY, $WORKSPACE_ID in the example with actual values.

Shell
curl -X POST "$CLOUDSIGMA_API_BASE/query/history/overview" \
  -H "X-API-Key: $CLOUDSIGMA_API_KEY" \
  -H "X-Workspace-ID: $WORKSPACE_ID" \
  -H 'Content-Type: application/json' \
  -d '{
  "start": "2026-08-26T08:00:00Z",
  "end": "2026-08-26T09:00:00Z"
}'

Field

Type

Required

Description

scope

string or null

No

Statistics of records of the current identity or current workspace. Values: empty string, self, workspace.

non_user

boolean or null

No

Whether to count non-user SQL at the same time.

start

string or null

No

Statistics start time, for example, 2026-08-26T08:00:00Z. RFC 3339 time.

end

string or null

No

Statistics end time, for example, 2026-08-26T09:00:00Z. RFC 3339 time.

sql_source_type

array of string or null

No

Filter by SQL source type. Non-empty arrays are filtered by their values.

When the time range is omitted, the deployment’s configured default query window is used. The window is not fixed at 5 minutes.

View range

scope value

Statistical records

Permission conditions.

self

A record of current identity.

Default scope.

workspace

Workspace scope records.

Workspace audit read permission is required.

Query time and SQL sources

The time must be filled in with the complete date, time and time zone. If the start and end times are not filled in, statistics will be recorded according to the default lookback window configured by the deployment. You can fill in only one of the times as the statistical boundary.

When filling in sql_source_type, statistics will be based on the specified source. When not filled in, non_user=true counts all sources. When false is filled in or omitted, only user SQL and external SQL will be counted.

Successful response

JSON
{
  "code": "OK",
  "msg": "OK",
  "data": {
    "total": 3,
    "success": 2,
    "running": 0,
    "failed": 1
  }
}

Field

Type

Description

data.total

integer

The total number of records matching the filter criteria.

data.success

integer

The number of records with status Success.

data.running

integer

The number of records with status Running.

data.failed

integer

The number of records with status Failed.

When you need to view a single SQL execution record, use Query SQL execution record.

Error response

JSON
{
  "code": "ErrParamInvalid",
  "msg": "请求参数无效"
}

Field

Type

Description

code

string

error code.

msg

string

error message.

Last updated on