Forum Discussion
How to run custom SQL queries in Azure Databricks without using ODBC in Power BI?
- 1 year ago
Hi everyone, thank you all for your contributions!
I wanted to share that I was able to solve the issue on my own. I had already read the documentation several times (including the official blog post), but I couldn’t get it to work in my specific context — especially through a script-based setup in Power Query.
In the end, I found a solution that worked by applying a native SQL query using this structure:
Fonte = Value.NativeQuery(
Databricks.Catalogs(
"adb-xxxx.azuredatabricks.net",
"/sql/1.0/warehouses/xxxx",
[Catalog = "dtXXXX", Database = null, EnableAutomaticProxyDiscovery = "enabled"]
){[Name="dtXXXX", Kind="Database"]}[Data],
"
SELECT * FROM your_table
WHERE my_column IS NOT NULL
"
)
This allowed me to run the SQL script directly without needing to rely on ODBC or predefined views.I’ll go ahead and mark the thread as resolved — though I won’t select any specific reply, since I was looking specifically for a script-based solution that I ended up crafting myself.
Thanks again to everyone who contributed!
Hi WILLIAM_AFFONSO,
The Databricks Power BI connector supports native query by following the steps posted in this Databricks blog:
https://www.databricks.com/blog/databricks-power-bi-connector-now-supports-native-query
Please let me know if following this guide works.
If this helped, please mark it as the solution so others can benefit too. And if you found it useful, kudos are always appreciated.
Thanks,
Samson