Export domain model with Mendix SDK

0
I'm trying to use the Mendix SDK to export the Domain Model of my application but I can't make it to work. I'm following the way it is explained in the Mendix Docs (https://docs.mendix.com/apidocs-mxsdk/mxsdk/sdk-howtos/) but there is no example of how to export the Domain Model. It should be possible, see https://docs.mendix.com/apidocs-mxsdk/mxsdk/sdk-use-cases/ (item Exporting your apps).   So has anyone maneged to export there Domain Model with the Mendix SDK (or some other way) to csv/json/xls/<others> and would like to share how to do that?
asked
1 answers
1

Hi Didier,


Yes, it is possible with the Mendix Model SDK, but there is no built-in function that directly exports the Domain Model to CSV, JSON, or Excel. The usual approach is to load the DomainModel, iterate through its entities, attributes, and associations, and generate your own output format. The SDK exposes these objects through the DomainModel API.


If your goal is simply to extract the model metadata, I would also look at MX CLI (mxcli.org). It can be a much quicker solution than writing a custom SDK script, depending on the format you're looking for.


Another option is using:

mx dump-mpr MyApp.mpr > model_dump.json

which exports the application model to JSON and can then be transformed into CSV, Excel, or another format. Mendix Support specifically mentions this as an approach for exporting application models.


Personally, I would start with MX CLI if the objective is reporting or documentation, and use the Model SDK only when custom processing or automation is required.


I hope this helps answer your question. If you need any additional details, feel free to reply below.


Best regards,

Oswaldo Valles

answered