You can query the mendix database using OQL. Here is the mendix documentation for OQL
Check these learning modules.
How to retrieve/show (bind) data to pages: https://gettingstarted.mendixcloud.com/link/module/5/lecture/86
How to retrieve data in mircroflows: https://gettingstarted.mendixcloud.com/link/module/8/lecture/195
- In the console, dropdown 'Advanced' set the loglevel of each ConnectionBus_* to Trace. That will get you the SQLs the database is receiving.
- In the console, dropdown 'Advanced' select the built in databaseviewer.
It sounds like you want to verify the data in an association maintained by Mendix (in your question you said you wanted to query a domain model association). If this is the case, there is not a way to programatically retrieve that data from the database. You could retrieve that data using an external tool but I'm not sure that would be very useful - that data in association tables consists of 2 Mendix guid's which don't have any meaning outside of the Mendix app. As an example, suppose I have an association called DocumentTypes_Client, Mendix will create and maintain the following table to manage this association:
You can see the data wouldn't be useful.
If you want to verify some data that has come from an external system, you could do that in one of two ways:
Maybe some of that is helpful to you.