0 / 0
Input data for Decision Optimization deployment jobs

Input data sources for Decision Optimization deployment jobs

When you submit a job you can include inline data, or reference your data in your request. This data is then mapped to a file named with data identifier and used by the model. The data identifier extension defines the format of the file used. You can define what input data you want to use and how you collect it (as either inline or referenced data).

Inline data

You can embed inline data in your request.

Tabular inline data
This example generates the corresponding diet_food.csv file that is used as the model input file. Only csv files are supported.
"input_data": [{
      "id":"diet_food.csv",
      "fields" : ["name","unit_cost","qmin","qmax"],
      "values" : [
                 ["Roasted Chicken", 0.84, 0, 10]
      ]
}]
Non-tabular inline data
This type of inline data is useful for files such as an OPL .dat file or an .lp file.
"input_data": [{
      "id":"diet_food.csv",
      "content":"<base64 encoded string>"
}]

Referenced data

Data assets
You can use data assets to reference any data asset or connected data asset present in your space and benefit from the data-connector integration capabilities. To use data assets from a project, you must first promote them to your space.

This example defines input data references to a data asset in space.

"input_data_references": [{
      "name": "diet_food.csv",
      "type": "data_asset",
      "connection": {},
      "location": {
            "href": "/v2/assets/<ASSET_ID>?space_id=<SPACE_ID>"
      }
}]
Connection assets
You can use connection assets to reference any data and then refer to the connection without having to specify credentials each time. Referencing a secure connection without having to use inline credentials in the payload also offers you better security. You can use the id to identify connections. For example,
"input_data_references": [{
      "type": "connection_asset",
      "connection": {
              "id" : "<CONNECTION_ID>",
      }
      "location": {  
              <other properties depending on connection type>
      }
}]

The <CONNECTION_ID> is the globally unique identifier for a connection. You can find this identifier when you have created a connection and you then edit the connection in your project. The identifier is visible in the Edit connection window's URL.

For information about job definitions, see Deployment job definitions.

You can specify the parameters that are required for the connection in the location field.

This example connects to a COS/S3 asset. The connection parameters are provided in the location field.
      "location": { 
            "file_name" : "<FILENAME>",
            "bucket" : "<BUCKET_NAME>"
      }
This example connects to a Db2 asset. The connection parameters are provided in the location field.
      "location" : { 
            "table_name" : "<TABLE_NAME>", 
            "schema_name" : "<SCHEMA_NAME>" 
      }

This example connects to a COS/S3 asset. The connection parameters are provided in the id field.

"input_data_references": [{
      "type": "connection_asset",
      "id": "diet_food.csv",
      "connection": {
            "id" : "<CONNECTION_ID>"
      },
      "location": {
            "file_name" : "<FILENAME>",
            "bucket" : "<BUCKET_NAME>"
      }
}]
This example shows you how to connect to a Db2 asset. The connection parameters are provided in the id field.
"input_data_references": [{
      "type" : "connection_asset",
      "id" : "diet_food.csv",
      "connection" : {
            "id" : "<CONNECTION_ID>"
      },
      "location" : {
            "table_name" : "<TABLE_NAME>",
            "schema_name" : "<SCHEMA_NAME>"
      }
}]

For more information about the interaction properties that you can use in the location field, see Platform connections in the main menu. On the Connections page, select Connection resources > Connection properties. Then select the Interaction properties > As a source tab for the relevant connector. You might need to create a Platform assets catalog.

For more information about the different connections available for Decision Optimization, see Supported data sources in Decision Optimization.

URL referenced data
You can use URL-referenced data to load data from a particular URL.
This example uses the GET command to retrieve the diet_food.csv file from a URL as input data for the Decision Optimization deployment job.
"input_data_references": {
      "type": "url",
      "id": "diet_food.csv",
      "connection": {
            "verb": "GET",
            "url": "https://myserver.com/diet_food.csv",
            "headers": {
                "Content-Type": "application/x-www-form-urlencoded"
            }
      },
   "location": {}
}

You can combine different types of data in the same request. For more information about data definitions, see Adding data to an analytics project.

Generative AI search and answer
These answers are generated by a large language model in watsonx.ai based on content from the product documentation. Learn more