skip to main content
Understanding and configuring a schema map
 

Try DataDirect Cloud Now

Understanding and configuring a schema map

As described in Configuring an OData schema map, you use the DataDirect Cloud dashboard's Configure Schema editor to generate or edit a schema map. The schema map specifies the tables, or objects, and columns that will be accessible to OData clients for a particular Data Source definition. A schema map can only include tables from one schema. To expose tables from multiple schemas (in the same data store) or to expose multiple data stores in a single OData endpoint, you can create a Data Source Group.
DataDirect Cloud generates schema maps as a JSON string. When fetching data to satisfy requests, the DataDirect Cloud OData service uses this schema to map a row in a table (or an object instance) to an entity, and to map the data in table columns (or object attributes) to entity properties. Progress recommends that you use the generated schema map. However, there are rare use cases that might require you to edit the JSON string. See JSON schema map syntax for a description of the syntax.

Primary and foreign keys

The schema map must specify how to uniquely identify a particular record. Many data store tables already have one or more primary key columns. The Configure Schema editor checks for a primary key in the tables you select, and identifies all tables that need to have a primary key defined. If a primary key is defined on a table, the OData service uses that primary key as the unique identifier and you cannot specify another. To expose tables that do not have a primary key, you must choose one or more columns to use as a virtual primary key. DataDirect Cloud automatically adds related tables for selected foreign key columns.
Note: Although the Schema Map editor lets you specify which tables and columns to expose to OData requests, it makes no change in the underlying data source. All columns of the data source are still available to SQL queries executed from the ODBC driver, JDBC driver, or the DataDirect Cloud SQL Editor regardless of whether they are exposed through OData.

Entity names

In some cases, you might want to modify the names that the Configure Schema editor assigns to an entity:
*By default, the DataDirect Cloud OData service uses a plural form of the table name as the entity name. The schema generator automatically appends es to table names. For example, a data source table named Customers will become a Customerses entity. You might want to explicitly set the name to Customers.
*If you are using a Data Source Group, table names in the member data sources can conflict. Therefore, when you create a Data Source Group, you must assign a unique prefix to each Data Source definition. When this is the case, it makes sense to use the same plural name for the tables in each schema map.
Queries must have the prefix appended to the plural entity name with an underscore separator. For example, two data sources in the same group might contain a Customer table. In the Configure Schema editor, you could assign the plural name Customers to the tables in both schemas. In the Data Source Group, you could use a prefix such as east for one member and west for the other. Query requests to the east_Customers entity will then go to the first data source, and requests to west_Customers to the second.
* Tour the Configure Schema editor
* Opening the Configure Schema editor
* Configure Schema editor quick reference
* JSON schema map syntax
* Schema map examples