skip to main content
Querying with OData Version 2 : Understanding and configuring a schema map for OData Version 2 : JSON schema map syntax
  

Try Now

JSON schema map syntax

The Configure Schema editor should be used to generate the OData schema map as described in Configuring data sources for OData Version 2 connectivity. In rare cases, manual editing of the schema map might be necessary. For OData Version 2 services, an odata_mapping_v2 format is supported.
A schema map consists of a JSON string that contains the following model elements:
{
"odata_mapping_v2": {
"schemas": [
{
"name": "«schema_name»",
"tables": {
"«table_name»":{
"ODataAlias": "«odata_name»",
"ODataPluralAlias": "«plural_odata_name»",
"searchMode": "none" or "begins" or "contains" or "full-text",
"columns": {
"«column_name»": {
"primaryKeyComponent": «integer»,
"searchable": «boolean»,
"indexType": "«text_index_name»"
} [, ... ]
},
"excludedColumns": [«column_name», ...]
} [, ... ]
},
"excludedTables": ["«table_name»", ...]
} [, ... ]
]
}
}
The following table lists elements alphabetically and provides a brief description. See Schema map examples for sample usage.
Element name
Parent
Description
columns
table_name
Contains column_name elements that define the details of columns included in a table. If the columns element is missing or empty, then all columns except the ones listed in excludeColumns are exposed.
column_name
columns
Backend data source column (or field) name. Properties determine whether the column is part of the primary key and is searchable.
excludedColumns
table_name
Comma-separated list of columns to hide from OData requests. This optional field is used only when the columns object is missing or empty.
excludedTables
schema_name
Comma-separated list of tables to hide from OData requests. Any tables not specified in this list that have a primary key column will be exposed for OData requests. This optional field is used only when the tables object is missing or empty.
indexType
column_name
The model contains this element to identify the type of index when the search mode is set to Full Text. For DB2 and SQL Server, TEXT is the only valid value. For Oracle, valid values include CONTEXT and CTXCAT.
name
schema_name
Contains the schema_name element. This is a required property for data sources that support schemas. For data sources such as MySQL that do not support schemas, set this to "null" or "-".
ODataAlias
table_name
The singular entity name to use in OData addresses for requests to this table.
ODataPluralAlias
table_name
The plural entity name to use in OData requests.
primaryKeyComponent
column_name
The data type of a column belonging to the primary key or null. The primary key is comprised of a set of columns to use as the primary key for a table that does not have a defined primary key. If this field is not specified or the key list is empty, the table must have a primary key defined in the database. If a primary key is defined for the table in the database and a primary key column list is also specified in the OData Schema Map parameter, the primary key defined in the database is used.
schema_name
None
Backend data source schema name, a required field. For data stores that do not support schemas, such as MySQL, the schemaName value should be null ("schemaName": null).
searchable
column_name
If true, the column is searchable, using the searchMode specified at the table level. If false, the column is not searchable.
searchMode
table_name
One of: none, not searchable; begins, search for the string only at the beginning of a field; contains, search for a specific string; full-text, use the data source index. The searchMode applies to columns enabled for search.
table_name
tables
Backend data source table (or object) name. Properties determine the name to be used in OData requests, primary key column(s), and whether any columns are searchable.
tables
schema_name
Contains table_name elements describing how to expose tables through OData, and an excludedTables element listing tables that should not be exposed. If the tables object is missing or empty, all tables, except for any table in the excludedTables array, are exposed.