skip to main content
Querying with OData Version 4 : Understanding and configuring a schema map for OData Version 4 : Schema map examples
  

Try Now

Schema map examples

In the following example from an Oracle data source, both the Employees and the Departments tables are enabled for full-text search. In the Employees table, the id column is searchable. In the Departments table, the id column is searchable and the address column is not included in the model; OData requests will not return data from the address column.

{
"odata_mapping_v3": {
"schemas": [{
"name": "Emp",
"tables":
{
"Employees": {
"ODataAlias": "Employee",
"ODataPluralAlias": "Employees",
"searchMode": "full-text",
"columns": {
"ID": {
"alias": "Test ID",
"primaryKeyComponent": 1,
"searchable": true,
"typeInfo": {
"dataType": "DECIMAL",
"columnSize": 14,
"isGenerated": true,
"isAutoIncrement": true,
"isNullable": false,
"scale": 4
}
}
"Departments":{
"ODataAlias": "Employee",
"ODataPluralAlias": "Employees",
"searchMode": "full-text",
"columns": {
"ID": {
"alias": "Test Department",
"primaryKeyComponent": 1,
"searchable": true,
"typeInfo": {
"dataType": "DECIMAL",
"columnSize": 24,
"isGenerated": true,
"isAutoIncrement": true,
"isNullable": false,
"scale": 4
}
},

"excludedColumns": ["address"]
}
}
}]
}
}



The following example uses tables in a MySQL datasource. As in the previous example, both the Employees and the Departments tables are enabled for full-text search. In the Employees table, the id column is searchable. In the Departments table, the id column is searchable and the address column is not included in the model; OData requests will not return data from the address column.
{
"odata_mapping_v3": {
"schemas": [{
"name": "Emp",
"tables":
{
"Employees": {
"ODataAlias": "Employee",
"ODataPluralAlias": "Employees",
"searchMode": "full-text",
"columns": {
"ID": {
"alias": "Test ID",
"primaryKeyComponent": 1,
"searchable": true,
"typeInfo": {
"dataType": "DECIMAL",
"columnSize": 14,
"isGenerated": true,
"isAutoIncrement": true,
"isNullable": false,
"scale": 4
}
}
"Departments":{
"ODataAlias": "Employee",
"ODataPluralAlias": "Employees",
"searchMode": "full-text",
"columns": {
"ID": {
"alias": "Test Department",
"primaryKeyComponent": 1,
"searchable": true,
"typeInfo": {
"dataType": "DECIMAL",
"columnSize": 24,
"isGenerated": true,
"isAutoIncrement": true,
"isNullable": false,
"scale": 4
}
},

"excludedColumns": ["address"]
}
}
}]
}
}