Primary key
- Last Updated: July 10, 2024
- 1 minute read
- DataDirect Connectors
- JDBC
- Autonomous REST Connector 6.0
- Documentation
You can designate the primary key for a table by modifying the Model file.
In the column object, add the
#key after the data type
element, separated by a comma. Note: When designating a new primary
key, you can query the
INFORMATION_SCHEMA.SYSTEM_SAMPLING_STATUS system
table for a list of potential primary key candidates. See "Determining the primary key"
for more information.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",
}
}