POST
/
api
/
v1
/
query
curl --request POST \
  --url https://your-engine-url/api/v1/query/ \
  --header 'Authorization: <api-key>' \
  --header 'Content-Type: application/json' \
  --data '{
  "query_string": "<string>",
  "template_id": 123,
  "template_name": "<string>",
  "parameters": {}
}'
{
  "query_id": "<string>",
  "statement_type": "<string>",
  "start_time": "2023-11-07T05:31:56Z",
  "end_time": "2023-11-07T05:31:56Z",
  "query": "",
  "referer": "",
  "state": "<string>",
  "destination_table_name": "<string>",
  "destination_schema": "<string>",
  "error_result": "<string>",
  "created_at": "2023-11-07T05:31:56Z",
  "records": [],
  "total_records": 0,
  "affected_records": 123
}

Authorizations

Authorization
string
header
required

Enter: 'Bearer <JWT>', where JWT is the access token. Example: Bearer access_token_comes_here

Query Parameters

schema
string

The schema to save the created table to. If no parameter is provided, defaults to "qm" if table_name is also not specified, and "public" otherwise.

table_name
string

The name that will be used to create the table produced by the query execution, if any. If not provided, defaults to a randomly generated name.

overwrite
boolean
default:false

Determines if the table shall be overwritten or not if it already exists.

max_results
integer
default:0

Specifies the maximum number of records that should be returned in the result set (max: 100).

Body

application/json
query_string
string

The query string to be executed. Can either be a complete or templated query.

template_id
integer

The ID of the query template to be used.

template_name
string

The name of the query template to be used.

parameters
object

A dictionary of parameters if a templated query is used.

Response

200
application/json
Successful Response
query_id
string

A unique ID that identifies the query.

statement_type
string

The query type (ex. SELECT, DELETE, etc).

start_time
string

The start time of the query execution.

end_time
string

The end time of the query execution.

query
string
default:

The query string that was executed.

referer
string
default:

Indicates where the REST API call was made from.

state
string

Shows the state of the query execution (either RUNNING or COMPLETE).

destination_table_name
string

Shows the table where the results are stored in (If the statement_type is a SELECT, a new destination_table is created. Otherwise, the destination_table_name shows the affected table).

destination_schema
string

Shows in which schema the destination_table is stored in.

error_result
string

Stores the error message if there was an error while executing the query.

created_at
string

Shows the timestamp of when the query log was created.

records
object[]

Returns a sample of the data (max. 100).

total_records
integer
default:0

The number of records returned with DQL queries.

affected_records
integer

The number of records that are affected by DML or DDL queries.