Data Model
This section explains the data models of extension and alternate keys.
Extension Data
The extension data model is used to store the user fields, which are received from the streaming platform or through APIs.
The local extension fields are stored as key-value pair in the database and it is linked to the main entity
In SQL based microservices, extension data is stored in a separate extension table with a foreign key relationship to the main entity table. Every microservice, which gets designed to support extension has extension table as designed using below schema.
The format of table name is <<EntityName>>_Extension.
| Column Name | Datatype | Description |
|---|---|---|
| name | String | Field name of the extension data |
| value | String | Field value of the extension data |
| entityId | String | Main entity ID (Foreign key) |
In the No-SQL database, the extension data is stored as name-value pair as a part of main entity table. Since the No-SQL database does not support any entity relationships across collection (tables), the extension data is provided as another column in the product entity collection or table.
| Column Name | Datatype | Description |
|---|---|---|
| extensionData | map<text,text> | Stores the data as name-value pair |
Alternate Key
Alternate key based query functionality can be enabled for the GET APIs based on the business requirement. MS framework generates an API pre function hook method, if the operation is configured as x-altkey=true.
The alternate key serves as an alternate unique identifier for each entity in addition to the product entity ID, which helps to retrieve an entity or update an entity in the microservice.
All microservices have a product alternate key table called MSAltKey, which helps to maintain mapping between the product key field and L3 alternate key value. Data model allows you to store more than one alternate key for the product entity table.
For the Party ID, the below table shows the possible values of alternate ID stored in MsAltKey table.
|
Alternate Key Type |
Alternate Key Value |
Entity ID |
|---|---|---|
|
OSPIType |
Ref1 |
CUST111 |
|
OSPIType |
Ref2 |
CUST222 |
|
MPID |
1222 |
CUST111 |
Data model of ms_altkey is shown below.
| Column Name | Datatype | Description |
|---|---|---|
| alternateKey | string | PK - Alternate key field value |
| entityId | string | Main entity table key value |
In this topic