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.
  POST api/sdi/v4/queries/{id}/executionJobs

Define the following header:

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

Request example

      {
        "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.
          {
            "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:
            {
              "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:
          {
            "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:

          {
            "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:
          {
            "description": "Running query with sample alias and parameters",
            "aliases": [
              {
                "attributeName": "vin",
                "aliasValue": "Vin"
              }
            ]
          }
    
  6. Execution Job with result type

    • User can provide a parameter "resultType" in create execution job request to indicate how the results of the query execution job should be returned.
    • The possible values for "resultType" are REST and FILE. REST is the default value for this parameter.
    • When "resultType" is set to REST, SDI returns the results of the query execution as a REST API response.
    • When the "resultType" is set to FILE, SDI stores the results of the query execution as file(s) in the IDL. The "resultDetail" parameter can be used to provide additional inputs to the API such as the desired file type and the results location in the IDL.
      {
        "description": "Running query with sample alias and parameters",
        "aliases": [
          {
            "attributeName": "catalog_book_id",
            "aliasValue": "model"
          }
        ],
        "resultType": "FILE",
        "resultDetail": {
              "fileType": "parquet",
              "location": "/sdiresults/"
          }
      }
      
    • Value provided at the time of job creation takes preference over value given at the time of query creation.

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.


Last update: September 19, 2022