Forum Discussion
Query Folding with Databricks.Catalogs Connector
- Anonymous3 years ago
I found a great solution and does not break Databricks Query Folding
use Databricks.Query instead of Databricks.Catalogs
If you want to lightweight your loading process
create a parameter like date_filter
let Source = Databricks.Query("warehouses" , [] ), part1 = "select * from TYPE YOUR TABLE", part2 = " WHERE snapshot_date > "&"'"&date_filter&"'", MyQuery = Source(part1 & part2) in MyQuery
Bumping this topic. Can someone point me to a guide on query folding in Power Query with the Azure Databricks connector?
The behavior mentioned in the above post is still present in 2024 in Power Query Online. In my opinion, it is unacceptable that simply selecting a table from Unity Catalog yields a "Will not fold" indicator. Even in Power BI Desktop, users will not see the "View Native Query" option, which would indicate the query is folding. I should not have to instruct users to use the Azure Databricks connector and then edit their M code to switch to Databricks.Query (which has no documentation other than this random LinkedIn post https://www.linkedin.com/uas/login?session_redirect=https%3A%2F%2Fwww.linkedin.com%2Fpulse%2Fquery-folding-azure-databricks-tushar-desai)
I can't be the only only one having trouble with this. I am trying to instill best practices with my community, and it is difficult when the Azure Databricks connector behaves so differently from others. Can anyone point me to a proper guide on how users can be sure their queries are folding with Databricks?
- jakaihammuda2 years agoHelper III
Yep, im struggling to get it working.
- Stachu2 years agoCommunity Champion
It seems that when the native query is provided in the connection UI the fold is also not breaking. PowerBI wraps the Databricks.Catalog in Value.NativeQuery, like this:
let Source = Value.NativeQuery(Databricks.Catalogs(server, http, [Catalog="samples", Database=null, EnableAutomaticProxyDiscovery=null]){[Name="samples",Kind="Database"]}[Data], "select * from nyctaxi.trips", null, [EnableFolding=true]) in SourceWhen analysed using the Diagnose feature it shows the source query is folded even though the View Native Query option is greyed out, but I must say I didn't verify it on the Databricks end