Skip to content

Creating ExecutionJobs for query using Semantic Data Interconnect (SDI)

SDI Data Query Service creates executionJobs for dynamic queries. This document describes how to create executionJobs.

Prerequisites

  • Semantic Data Interconnect provisioned to the tenant.
  • A SDI role: either SDI admin or technical user credentials.
  • ExecutionJob can be created only for existing dynamic query.
1
  POST api/sdi/v4/queries/{id}/executionJobs

Define the following header:

1
2
  Authorization: {Bearer Token}
  Content-Type: application/json

Request example

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
      {
        "description": "Running query with sample alias and parameters",
        "parameters": [
          {
            "paramName": "column1",
            "paramValue": "'abc'"
            }
        ],
            "aliases": [
          {
            "attributeName": "column1",
            "aliasValue": "abc"
          }
        ]
          }

Note

  1. Parameters and/or aliases must be provided in the request, both cannot be null or empty.
  2. Placeholder name should be same as column name. For details, refer examples section.

Request attribute details

Parameter Description Type Mandatory Default value
description More details about executionJob String No null
paramName Placeholder name (same as column name) provided in query String No null
paramValue User provided value. Datatype of value should be same as column Any No null
attributeName Column name from select list String no null
aliasValue Display name for column value String no null
id (path param) Id of existing dynamic query String yes

Examples

  1. Query with parameter of type String

    • Dynamic Query: select sditest_vehicle.vin from sditest_vehicle where, sditest_vehicle.vin = :"sditest_vehicle.vin" and sditest_vehicle.def = 'BMW'
    • Placeholders used: sditest_vehicle.vin
    • Column name: sditest_vehicle.vin
    • Column data type: String
    • ExecutionJob request:
    • =: is used to indicate equal to operator for dynamic parameter. This can be replaced with >: for greater than equal to operation.
      1
      2
      3
      4
      5
      6
      7
      8
      9
          {
            "description": "Running query with sample alias and parameters",
            "parameters": [
              {
                "paramName": "sditest_vehicle.vin",
                "paramValue": "'abc'"
              }
              ]
          }
      
  2. Query with parameter of type Integer

    • Dynamic Query : select sditest_vehicle . vin from sditest_vehicle where, sditest_vehicle.vin = :" sditest_vehicle . vin" and sditest_vehicle.def = 'BMW'
    • Placeholders used: sditest_vehicle . vin
    • Column name: sditest_vehicle . vin
    • Column data type: Integer
    • ExecutionJob request:
    1
    2
    3
    4
    5
    6
    7
    8
    9
            {
              "description": "Running query with sample alias and parameters",
              "parameters": [
                {
                  "paramName": "`sditest_vehicle`.`vin`",
                  "paramValue": 123
                  }
              ]
            }
    
  3. Query with parameter of type Boolean and alias

    • Dynamic Query: select vin from sditest_vehicle where, vin = :"vin" and def = 'BMW'
    • Placeholders used: vin
    • Column name: vin
    • Column data type: Boolean
    • Does user want to provide alias: true
    • ExecutionJob request:
     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    12
    13
    14
    15
          {
            "description": "Running query with sample alias and parameters",
            "parameters": [
                {
                "paramName": "vin",
                "paramValue": true
                }
            ],
            "aliases": [
              {
                "attributeName": "vin",
                "aliasValue": "Vin"
              }
            ]
          }
    
  4. Query with parameter of type Boolean and alias on an aggregate function

    • Dynamic Query: select count(vin) from sditest_vehicle where, vin = :"vin" and def = 'BMW'
    • Placeholders used: vin
    • Column name: vin
    • Column data type: Boolean
    • Does user want to provide alias: true

    • ExecutionJob request:

     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    12
    13
    14
    15
          {
            "description": "Running query with sample alias and parameters",
            "parameters": [
                {
                "paramName": "vin",
                "paramValue": true
                }
            ],
            "aliases": [
              {
                "attributeName": "count(vin)",
                "aliasValue": "Vin"
              }
            ]
          }
    
  5. Query with alias

    • Dynamic Query: select distinct vin from sditest_vehicle where, def = 'BMW'
    • Column name: vin
    • Does user want to provide alias: true
    • ExecutionJob request:
    1
    2
    3
    4
    5
    6
    7
    8
    9
          {
            "description": "Running query with sample alias and parameters",
            "aliases": [
              {
                "attributeName": "vin",
                "aliasValue": "Vin"
              }
            ]
          }
    

Limitations

  • The values provided in the parameters for dynamic queries should match with datatype of corresponding attribute. Otherwise, the system will not validate this during query execution request.

Any questions left?

Ask the community


Except where otherwise noted, content on this site is licensed under the MindSphere Development License Agreement.