Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
olegkazanskyi
Helper II
Helper II

DMV request to Power BI Server Analysis Services for hidden tables in PowerQuery

I try to get the list of tables with M codes from PowerBI online Analysis Service.

I managed to get the required data with the request:

 

SELECT *
FROM $SYSTEM.TMSCHEMA_PARTITIONS

 

But it doesn't show any tables that were selected not to "Load" in PowerQuery.

The purpose of this task is to get all data connections from a dataset and hidden tables are essential.

 

Does anyone know how to get the hidden tables' codes?

3 ACCEPTED SOLUTIONS


@lbendlin wrote:

@d_gosbell  that one also only shows the queries that have Load enabled.


Not according to my tests.

 

I just added 2 queries to DimProductCategory both set to disable the load, one was referenced as a merged query for DimProductSubcategory the other was completely unreferenced and both show up in the TMSCHEMA_EXPRESSIONS and neither show up in TMSCHEMA_PARTITIONS (although I can see a reference to the first one in the merge step in the DimProductSubcategory M code )

 

d_gosbell_0-1639366548718.png

 

View solution in original post


@lbendlin wrote:

Interesting. I get rather inconsistent results. need to test more variations. What would be the reason for Query3 to not appear in the attached sample? 


So the documentation for the DMVs is pretty poor, but it seems to me that TMSCHEMA_PARTITIONS contains the text for any queries that are loaded and TMSCHEMA_EXPRESSIONS contains the text for any queries that are not loaded.

 

So when I query your file I see the following

 

TMSCHEMA_PARTITIONS - shows "Query 3"

TMSCHEMA_EXPRESSIONS - shows "Query 1" and "Query 2"

 


@lbendlin wrote:

 Where can I see the lineage details?


If I query the DISCOVER_CALC_DEPENDENCY DMV I can see that "Query 3" has a dependency on "Query 1"

View solution in original post

Brilliant.  @olegkazanskyi this means you need to run both DMVs to get your desired result.

View solution in original post

8 REPLIES 8
d_gosbell
Super User
Super User

Partitions are the objects that hold the data that gets loaded into the model, so it is not expected that the partition information would show you any queries that are marked as "not loaded". So this has nothing to do with the partitions being hidden.

 

The location of the query metadata has changed over the years, but I believe you will find these queries in the $SYSTEM.TMSCHEMA_EXPRESSIONS DMV.

@d_gosbell  that one also only shows the queries that have Load enabled.


@lbendlin wrote:

@d_gosbell  that one also only shows the queries that have Load enabled.


Not according to my tests.

 

I just added 2 queries to DimProductCategory both set to disable the load, one was referenced as a merged query for DimProductSubcategory the other was completely unreferenced and both show up in the TMSCHEMA_EXPRESSIONS and neither show up in TMSCHEMA_PARTITIONS (although I can see a reference to the first one in the merge step in the DimProductSubcategory M code )

 

d_gosbell_0-1639366548718.png

 

@d_gosbell Interesting. I get rather inconsistent results. need to test more variations. What would be the reason for Query3 to not appear in the attached sample? Where can I see the lineage details?


@lbendlin wrote:

Interesting. I get rather inconsistent results. need to test more variations. What would be the reason for Query3 to not appear in the attached sample? 


So the documentation for the DMVs is pretty poor, but it seems to me that TMSCHEMA_PARTITIONS contains the text for any queries that are loaded and TMSCHEMA_EXPRESSIONS contains the text for any queries that are not loaded.

 

So when I query your file I see the following

 

TMSCHEMA_PARTITIONS - shows "Query 3"

TMSCHEMA_EXPRESSIONS - shows "Query 1" and "Query 2"

 


@lbendlin wrote:

 Where can I see the lineage details?


If I query the DISCOVER_CALC_DEPENDENCY DMV I can see that "Query 3" has a dependency on "Query 1"

Brilliant.  @olegkazanskyi this means you need to run both DMVs to get your desired result.

This is a wonderful insight into the DMV queries results.

Thank you!

lbendlin
Super User
Super User

Interesting observation.  You can see the "hidden" queries with 

 

select * from $SYSTEM.TMSCHEMA_PARTITION_STORAGES

 

but you can't get to the query meta data.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.