I am looking for a script to create views in my database so that it matches the Entities in the Model

0
Does anyone have a script to automatically create Database views so that they match the Entities in the Domain Models?  
asked
2 answers
0

As far as i'm aware, we don't have such a script. You should be able to create it though, either using the Mendix Java api, or using the SDK.

I assume you are running on-premises, as you will not have direct database access for reporting in the mendix cloud. The reason for this is that security is handled by the Mendix runtime, so anybody having access to either the tables or database views on top of these tables would have access to all data, not just the data he's allowed to see.

So, if you want to do this, you probably need to include the security rules as defined in your datamodel into your views.

Another difficulty is that depending on your database (postgres,oracle,...) database views may prevent project upgrades to work correctly. In certain versions of postgres you cannot alter a table if some view is depending on it. This means that you would have to remove all views before a deploy, and recreate them afterwards. From this perspective it's probably best to create a reporting database (either using a daily backup, or logstreaming or similar) and create the views in this read only reporting database.

As an alternative to direct database reporting you can use oData in Mendix. This enables you to create a number of Rest resources matching your entities, that can be directly used in Ms-Excel, Tableau or PowerBI.

answered
-1

I might be misunderstanding you, but if you create a datagrid connect it to the entity you want to show and it will ask you to fill it automaticly with all the attributes from that entity.

Regards,

 

Ronald

 

answered