skip to main content
Using the driver : Configuring the relational map : Modifying the relational view : Designating the primary key
  

Try DataDirect Drivers Now
Designating the primary key
You can designate the primary key for a table by modifying the REST file. In the column object, add the #key after the data type element, separated by a comma. In the following example, the employeeID column has been designated the primary key for this table:
{
"my_table":{
"#path":[
"https://example.com/employees"
],
"employeeID":"VarChar(32),#key",
"position_title":"VarChar(46)",
"start_year":"Integer",
}
}
You an also create a composite primary key by using the #key element to designate multiple columns in a definition. For example, the values of the employeeID and position columns act as a composite key in the following:
{
"my_table":{
"#path":[
"https://example.com/employees"
],
"employeeID":"VarChar(32),#key",
"position":"Integer",#key,
"position_title":"VarChar(46)",
"start_year":"Integer",
}
}
Your changes will be updated during your next connection. See "Modifying the relational view" for details on regenerating the REST file to include your changes.