We’ve recently released a new Logical Data Model (LDM) API that allows you to create logical data models in GoodData without having to use our CloudConnect LDM Modeler application or manually compose low-level MAQL DDL scripts.
The two main use cases are:
- Creating a new model in empty project
- Updating an existing model
You will need to create a
JSON payload that describes your data model and post it to this API. The API will generate a complete and valid MAQL script that you can execute using our ldm/manage2 API.
See the LDM API documentation.
How to Use It
Let’s say we are going to create new logical data model for our well known HR Demo.
The corresponding JSON definition looks as follows:
This structure is much more compatible for integrations using your favorite programming language such as Ruby, Python etc. You can store this definition easily in database, add datasets and provision those models.
How do you create this model using the new API?
Simply POST the payload above to the following resource:
As a response, you will receive the link to asynchronous task and once you GET this link, you are able to see the result:
Extract the MAQL from the response body, update to comply with the JSON payload for the ldm/manage2 API and use the POST request:
preserveData: true | false -> this flag identifies MAQL with/without “preserve data” statement
cascadeDrops: true | false -> this flag tells you if the MAQL script contains cascade drops
Making Changes to the Data Model
Making changes is similar to and just as easy as creating a new model. All you need to do is to POST the new model to:
As a result, you will receive the link to the “update MAQL” script. Once you GET it (see the previous step) - you can POST it to the ldm/manage2 API.
If you are just adding some objects to the model, you don’t need to worry about losing something. If you are deleting something be sure to check the result. All reports and dashboards will be dropped with corresponding objects.
Tip For Developers
With this functionality you can store datasets in the database and create a custom model programmatically. Using this approach, you are able to build a modular solution on the top of GoodData Platform. Imagine a use case where you have 5 (or 50) data sources - each one is single dataset - but you want to select just 2 for client A and other 3 for client B. Using this API you are able to automate this process.