The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hi all,
I'm using Databricks.Catalogs connector to get data from Databricks Database Tables in the import mode (using the online Dataflows).
The problem is that my query is not folded even though I do not use any complex transformation logic. However, when I inspect the Query plan for the last step of the query, I can see only nodes which are folded.
What may be the causes behind the query not folding in this scenario?
Thank you.
Boris.
Solved! Go to Solution.
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-f...
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?
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
Source
When 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
Yep, im struggling to get it working.
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
Done:
= let
Source= Databricks.Query("xxxxx.cloud.databricks.com", "/sql/1.0/warehouses/xxxxxxx", [Catalog="hive_metastore", Database="schema_xxxx", EnableAutomaticProxyDiscovery=null]),
hive_metastore_Database = Fonte("SELECT * FROM hive_metastore.schema_xxxx.tablename T")
in
hive_metastore_Database
Hello gustavoleo_RJ,
thank you. This seems to help with my issue indeed.
For some reason I can't find the documentation of the Databricks.Query in the M language reference. Do you know if it is there?
Thank you.
Kind regards,
Boris.
Hi @Anonymous
Can you show the M code of this query? You can open Advanced Editor and find all code there. Or you can use Query folding indicators to check which steps are preventing your query from folding. Reorder them if necessary to increase folding.
Best Regards,
Community Support Team _ Jing
Hello Jing,
thank you for your message.