Build a Logical Data Model

How to build a logical data model?

A logical data model (LDM) is an abstract view of your data in GoodData Cloud Native (GoodData.CN). The LDM is a set of logical objects (datasets ) and their relationships that represent the data objects and their relationships in your database.

You can create an LDM:

  • Automatically

    This approach is suitable for simple databases (for example, the database with the demo data) or for databases that are prepared for building analytics .

  • Manually

    This approach is suitable for complex databases, for databases that store only a part of the metadata (for example, relations are handled by application logic and not by foreign keys in the database), or if you want to build your analytic experience iteratively.

Create an LDM Automatically

When you create an LDM automatically, GoodData.CN scans your database schema, reads its metadata and suggests the LDM based on the tables and views in your database.

  • The tables and views are converted to datasets.
  • Attributes and facts in the datasets are derived from the table columns based on their data types.
  • Primary keys and references between datasets are detected from referential integrity stored in the database.

To make sure that your data is interpreted correctly, learn what rules are applied when the LDM is created and make sure that your database follow them.

Steps:

  1. Open the demo workspace.

  2. Click the Data tab.

    The LDM Modeler opens. You see a blank canvas area in view mode.

  3. Click Edit.

    The LDM Modeler is switched to edit mode. You can see the registered data sources in the left panel. If you connected the database with the demo data , you can see the demo-ds data source.

    Empty model

  4. Click Scan next to the data source.

    The scan dialog opens.

    Scan dialog

  5. Keep the predefined options as is, and click Scan.

    The scanning process starts. When the scanning completes, the LDM is created.

    Demo model

    At this point, the LDM is not published to your workspace yet. You are going to publish it.

  6. Click Publish in the top right corner.

    The publishing dialog opens.

    Publish dialog

  7. Click Publish in the dialog.

    The publishing process starts. When the publishing completes, you see a message that the LDM has been published.

    Published model

Once you have created the LDM, you can start building dashboards and insights .

Create an LDM Manually

To create an LDM manually, you are going to create datasets and connect them in a way that the LDM fits your needs. Then, you are going to map the datasets to the tables and columns in your database.

We recommend that you start with a small model, get familiar with the GoodData.CN analytical capabilities, check whether the LDM structure fits your needs, and then add additional datasets to the LDM.

Steps:

  1. Open the demo workspace.

  2. Click the Data tab.

    The LDM Modeler opens. You see a blank canvas area in view mode.

  3. Click Edit.

    The LDM Modeler is switched to edit mode. You can see the registered data sources in the left panel. If you connected the database with the demo data , you can see the demo-ds data source.

    Empty model

  4. Create datasets for your LDM. To learn how to work with the LDM components, see LDM Modeler .

    1. To add a dataset, drag Empty dataset from the left panel and drop it in the blank canvas area.

      New dataset

    2. Add fields (facts and attributes) to the dataset.

      Creating dataset fields

    3. Create as many datasets as you need, then connect the datasets with relationships.

      Creating relationships

    When you are done with creating the LDM, you are going to scan the data source and map the LDM components to the database schema.

  5. Click Scan next to the data source.

    The scan dialog opens.

  6. De-select the Generate datasets checkbox to prevent automatic generation of datasets.

    Scan dialog

  7. (Optional) If you want to limit the number of tables to scan in the database, expand the Advanced Settings section and enter the table prefix. This way, only the tables with names containing the prefix will be scanned and propagated to the LDM as datasets.

  8. Click Scan.

    The scanning process starts. It scans the physical tables in your database so that you can then map the LDM components to the tables and columns in your database (that is, map the datasets to the tables and map attributes/facts/references to the table columns).

    When the scanning completes, you see a confirmation message.

  9. Set up mapping for all the datasets in your LDM.

    1. Select a dataset, click More… -> View details.
    2. Click the Data mapping tab.
    3. Map the dataset to a particular table in your database.
    4. Map each field in the dataset to a specific column in this table.
    5. Click Save changes.
    6. Repeat Steps 1-5 for every dataset.

    Data mapping

    When you are done with setting up mapping for all the datasets, you are going to publish the LDM to the workspace.

  10. Click Publish in the top right corner.

    The publishing dialog opens.

  11. Click Publish in the dialog.

    The publishing process starts. When the publishing completes, you see a message that the LDM has been published.

    Published model

Once you have created the LDM, you can start building insights and dashboards .