Forum Discussion
Get Table information from dataset Programmatically
Sorry for the confusion lbendlin .
My need is to programatically find the list of source tables which are backing a given powerbi report.
That's what I gave you with the DMV query. You need to take that M code and parse it. It contains the server, database and query.
- lbendlin6 years agoSuper User
Most likely you connected to the wrong endpoint. Different dataset maybe?
- lbendlin6 years agoSuper User
No, once you access the dataset it doesn't matter much if the query connection type is import/ direct query or mixed.
I just tried it with one of my direct query datasets and got the expected result.
As expected it will not work at all with live connections.
- Anonymous5 years agoNot applicable
I had the same problem as pgelli when using lbendlin 's suggestion of SELECT * FROM $SYSTEM.TMSCHEMA_PARTITIONS; I was receiving the DAX QueryDefinitions and not the M Query defintions (super useful, just not what I needed). What solved it for me was instead using SELECT * FROM $System.DISCOVER_M_expressions. Hopefully this saves someone else some time for this use case.