Advanced Modelling Use Cases
Every database is different, and sometimes one or more of the following edge case scenarios may need to be considered when modelling the data.
Multiple Datasets Mapped to the Same Table
This is typically needed when one table represents multiple logical entities, and each entity should be represented by a separate dataset in the LDM.
While the LDM Modeler supports mapping of multiple datasets to the same table, publishing an LDM with such mapping fails.
To avoid this issue, create multiple views on top of the table and map each dataset to a separate view.
For example, you have two tables, users and tickets.
- The
userstable contains ticket creators and assignees. - The
ticketstable contains theassignee_idandcreator_idcolumns.
To avoid mapping multiple datasets to the users table, do the following:
- In the database, create two views on top of the
userstable:v_users_assigneesandv_users_creators. - In the LDM, create three datasets:
assignees,creators, andtickets. - Map the
ticketsdataset to theticketstable. - Map the
assigneesdataset to thev_users_assigneesview. - Map the
creatorsdataset to thev_users_creatorsview. - Create a relationship from the
assigneesdataset to the theticketsdataset using theassignee_idcolumn as a primary key in theassigneesdataset. - Create a relationship from the
creatorsdataset to theticketsdataset using thecreator_idcolumn as a primary key in thecreatorsdataset.
Using Multiple Data Sources in an LDM
Beta Feature
Support for multiple data sources in an LDM is a beta feature and not recommended for production use. Creating links between arbitrary datasets from different data sources is not yet supported, even though the UI can visualize the connection.
- You can use datasets from different data sources in an LDM, but they can only be connected using common date dimension datasets. This allows applying a common date filter to them.
- Each visualization or metric can use only a single data source, but you can place visualizations from multiple data sources on a dashboard.
- Attempting to execute a visualization requiring data from multiple sources will not succeed.
- The list of data sources prioritizes those already used in the current model. You can change the data source in dataset mapping.
No Single-column Primary Key in Tables
While the LDM Modeler supports setting multi-column primary keys in datasets, publishing an LDM with multi-column primary keys fails.
To avoid this issue, create one-attribute primary keys in your database:
- Concatenate the table columns that comprise the primary key in the table.
- Calculate a hash value for the concatenated columns.
- Use the hash value as a one-attribute primary key.