Datamart Queries
Operations related to OTQL Queries, the query language for datamarts based on GraphQL. OTQL (Object Tree Query Language) enables querying user data across millions/billions of objects using a SELECT/FROM/WHERE pattern. Queries can be saved as objects for reuse in segments, exports, and other features with performance optimization through caching.
Relevant documentation:
Execute an OTQL query with a segment id
The datamart for which we register the query
The id of the query to execute. If provided, the body will be ignored
The segment id to decorate que query with
The tree index to use. Default to USER_INDEX
In case of select queries, the limit of returned elements
In case of select queries, the offset of the first element
Precision used to execute the query. Default to FULL_PRECISION
Use the cache
Technical initiator
Success !
Error response
Error response
Error response
Error response
Error response
Error response
POST /v1/datamarts/{datamart_id}/queries/{query_id}/segments/{segment_id}/execution HTTP/1.1
Host: api.mediarithmics.local
Content-Type: text/plain
Accept: */*
Content-Length: 6
"text"{
"status": "ok",
"data": {
"warning_message": "text",
"took": 0,
"limit": 0,
"cache_result_ts": 0,
"offset": 0,
"result_type": "COUNT",
"rows": "text",
"precision": "FULL_PRECISION",
"sampling_ratio": 0,
"cache_hit": false,
"timed_out": false
}
}The datamart for which we register the query
The tree index to use. Default to USER_INDEX
The id of the query to execute. If provided, the body will be ignored
In case of select queries, the limit of returned elements
In case of select queries, the offset of the first element
Precision used to execute the query. Default to FULL_PRECISION
Use the cache
Technical initiator
Success !
Error response
Error response
Error response
Error response
Error response
Error response
POST /v1/datamarts/{datamart_id}/query_executions/otql HTTP/1.1
Host: api.mediarithmics.local
Content-Type: text/plain
Accept: */*
Content-Length: 6
"text"{
"status": "ok",
"data": {
"warning_message": "text",
"took": 0,
"limit": 0,
"cache_result_ts": 0,
"offset": 0,
"result_type": "COUNT",
"rows": "text",
"precision": "FULL_PRECISION",
"sampling_ratio": 0,
"cache_hit": false,
"timed_out": false
}
}The datamart for which we register the query
The schema against which we want to run the query (default to live)
The tree index on which we want to run the query (default to live)
The engine type to run the query on - default to TREE_INDEX
The data warehouse id, required for SQL queries
Technical initiator
Success !
Error response
Error response
Error response
Error response
Error response
Error response
POST /v1/datamarts/{datamart_id}/query_executions_async/otql HTTP/1.1
Host: api.mediarithmics.local
Content-Type: text/plain
Accept: */*
Content-Length: 6
"text"{
"status": "ok",
"data": {
"id": "123e4567-e89b-12d3-a456-426614174000",
"validation": {
"type": "SUCCESS",
"validation": {
"parameters": [
{
"reference_model_type": "text",
"parameter_name": "text",
"type": "text",
"container_type": "text",
"reference_type": "text",
"directive": "text",
"data_type": "text",
"path": [
"text"
],
"field_name": "text"
}
]
}
}
}
}Datamart id
Success !
Error response
Error response
Error response
Error response
Error response
Error response
POST /v1/datamarts/{datamart_id}/query_translations HTTP/1.1
Host: api.mediarithmics.local
Content-Type: application/json
Accept: */*
Content-Length: 189
{
"output_query_language_subtype": "PARAMETRIC",
"input_query_language": "SELECTORQL",
"output_query_language": "SELECTORQL",
"input_query_text": "text",
"input_query_language_subtype": "PARAMETRIC"
}{
"status": "ok",
"data": {
"output_query_language_subtype": "PARAMETRIC",
"input_query_language": "SELECTORQL",
"output_query_language": "SELECTORQL",
"output_query_text": "text",
"input_query_text": "text",
"input_query_language_subtype": "PARAMETRIC"
}
}Datamart id
Success !
Error response
Error response
Error response
Error response
Error response
Error response
POST /v1/datamarts/{datamart_id}/query_check/otql HTTP/1.1
Host: api.mediarithmics.local
Content-Type: application/json
Accept: */*
Content-Length: 16
{
"query": "text"
}{
"status": "ok",
"data": {
"type": "SUCCESS",
"validation": {
"parameters": [
{
"reference_model_type": "text",
"parameter_name": "text",
"type": "text",
"container_type": "text",
"reference_type": "text",
"directive": "text",
"data_type": "text",
"path": [
"text"
],
"field_name": "text"
}
]
}
}
}Datamart id
Success !
Error response
Error response
Error response
Error response
Error response
Error response
POST /v1/datamarts/{datamart_id}/query_autocomplete/otql HTTP/1.1
Host: api.mediarithmics.local
Content-Type: application/json
Accept: */*
Content-Length: 45
{
"query": "text",
"position": {
"row": 0,
"col": 0
}
}{
"status": "ok",
"first_result": 1,
"total": 1,
"max_results": 1,
"data": [
{
"object_type_name": "text",
"field_name": "text"
}
],
"count": 1
}The datamart for which we register the query
max time to wait before answering (in milliseconds), either with the result or a running execution
Success !
Error response
Error response
Error response
Error response
Error response
Error response
GET /v1/datamarts/{datamart_id}/query_executions_async/otql/{query_id} HTTP/1.1
Host: api.mediarithmics.local
Accept: */*
{
"status": "ok",
"data": {
"type": "ERROR_RESULT",
"query_status": "REGISTERED",
"error": "TREE_INDEX_ERROR",
"retryable": false
}
}Run asynchronously a submitted query
The datamart for which we register the query
max time to wait before answering (in milliseconds), either with the result or a running execution
Success !
Error response
Error response
Error response
Error response
Error response
Error response
PUT /v1/datamarts/{datamart_id}/query_executions_async/otql/{query_id} HTTP/1.1
Host: api.mediarithmics.local
Accept: */*
{
"status": "ok",
"data": {
"type": "ERROR_RESULT",
"query_status": "REGISTERED",
"error": "TREE_INDEX_ERROR",
"retryable": false
}
}Query language
Query is favorite
Success !
Error response
Error response
Error response
Error response
Error response
Error response
GET /v1/datamarts/{datamart_id}/queries/{id} HTTP/1.1
Host: api.mediarithmics.local
Accept: */*
{
"status": "ok",
"data": {
"datamart_id": "text",
"major_version": 0,
"query_language_subtype": "PARAMETRIC",
"query_text": "text",
"favorite": false,
"minor_version": 0,
"query_language": "SELECTORQL",
"id": "text"
}
}0false0Success !
Error response
Error response
Error response
Error response
Error response
Error response
PUT /v1/datamarts/{datamart_id}/queries/{id} HTTP/1.1
Host: api.mediarithmics.local
Content-Type: application/json
Accept: */*
Content-Length: 142
{
"major_version": 0,
"query_language_subtype": "PARAMETRIC",
"query_text": "text",
"favorite": false,
"minor_version": 0,
"query_language": "SELECTORQL"
}{
"status": "ok",
"data": {
"datamart_id": "text",
"major_version": 0,
"query_language_subtype": "PARAMETRIC",
"query_text": "text",
"favorite": false,
"minor_version": 0,
"query_language": "SELECTORQL",
"id": "text"
}
}Success response
Error response
Error response
Error response
Error response
Error response
Error response
DELETE /v1/datamarts/{datamart_id}/queries/{id} HTTP/1.1
Host: api.mediarithmics.local
Accept: */*
{
"status": "ok"
}Translate a Json type expression to an output_type expression
Datamart id
Success !
Error response
Error response
Error response
Error response
Error response
Error response
POST /v1/datamarts/{datamart_id}/expression_translations HTTP/1.1
Host: api.mediarithmics.local
Content-Type: application/json
Accept: */*
Content-Length: 189
{
"output_query_language_subtype": "PARAMETRIC",
"input_query_language": "SELECTORQL",
"output_query_language": "SELECTORQL",
"input_query_text": "text",
"input_query_language_subtype": "PARAMETRIC"
}{
"status": "ok",
"data": {
"output_query_language_subtype": "PARAMETRIC",
"input_query_language": "SELECTORQL",
"output_query_language": "SELECTORQL",
"output_query_text": "text",
"input_query_text": "text",
"input_query_language_subtype": "PARAMETRIC"
}
}The datamart for which we register the query
Success !
Error response
Error response
Error response
Error response
Error response
Error response
POST /v1/datamarts/{datamart_id}/query_executions_async/otql/{query_id}/action HTTP/1.1
Host: api.mediarithmics.local
Content-Type: application/json
Accept: */*
Content-Length: 19
{
"action": "CANCEL"
}{
"status": "ok",
"data": {
"type": "ERROR_RESULT",
"query_status": "REGISTERED",
"error": "TREE_INDEX_ERROR",
"retryable": false
}
}The datamart for which we register the query
The tree index to use. Default to USER_INDEX
The id of the query to execute. If provided, the body will be ignored
In case of select queries, the limit of returned elements
In case of select queries, the offset of the first element
Precision used to execute the query. Default to FULL_PRECISION
Use the cache
Technical initiator
0Success !
Error response
Error response
Error response
Error response
Error response
Error response
POST /v1/datamarts/{datamart_id}/query_executions/jsonotql HTTP/1.1
Host: api.mediarithmics.local
Content-Type: application/json
Accept: */*
Content-Length: 495
{
"operations": [
{
"selections": [
{
"name": "text",
"selections": [
"[Circular Reference]"
],
"directives": [
"[Circular Reference]"
],
"alias": "text"
}
],
"directives": [
{
"name": "text",
"arguments": [
"[Circular Reference]"
]
}
]
}
],
"language_version": "text",
"from": "text",
"limit": 0,
"join": [
{
"from": "text",
"where": {
"type": "GROUP",
"expressions": [
"[Circular Reference]"
],
"negation": false,
"boolean_operator": "AND"
}
}
],
"where": {
"type": "GROUP",
"expressions": [
"[Circular Reference]"
],
"negation": false,
"boolean_operator": "AND"
}
}{
"status": "ok",
"data": {
"warning_message": "text",
"took": 0,
"limit": 0,
"cache_result_ts": 0,
"offset": 0,
"result_type": "COUNT",
"rows": "text",
"precision": "FULL_PRECISION",
"sampling_ratio": 0,
"cache_hit": false,
"timed_out": false
}
}Query language
Query language subtype
Query is favorite
Success !
Error response
Error response
Error response
Error response
Error response
Error response
GET /v1/datamarts/{datamart_id}/queries HTTP/1.1
Host: api.mediarithmics.local
Accept: */*
{
"total": 1,
"first_result": 1,
"status": "ok",
"data": [
{
"datamart_id": "text",
"major_version": 0,
"query_language_subtype": "PARAMETRIC",
"query_text": "text",
"favorite": false,
"minor_version": 0,
"query_language": "SELECTORQL",
"id": "text"
}
],
"max_results": 1,
"count": 1
}0false0Success !
Error response
Error response
Error response
Error response
Error response
Error response
POST /v1/datamarts/{datamart_id}/queries HTTP/1.1
Host: api.mediarithmics.local
Content-Type: application/json
Accept: */*
Content-Length: 142
{
"major_version": 0,
"query_language_subtype": "PARAMETRIC",
"query_text": "text",
"favorite": false,
"minor_version": 0,
"query_language": "SELECTORQL"
}{
"status": "ok",
"data": {
"datamart_id": "text",
"major_version": 0,
"query_language_subtype": "PARAMETRIC",
"query_text": "text",
"favorite": false,
"minor_version": 0,
"query_language": "SELECTORQL",
"id": "text"
}
}Last updated
Was this helpful?