Forum Discussion
Adding query hints in M (Vertica)
Hi,
Is there some function or property in M to add query hints?
We are using Vertica as backend data warehouse and OleDB driver to access it from Power BI. When running queries in a SQL tool, we can specify
select /*+ label('Power BI Report') */ col1 from table 1;
By specifying "/*+ label('') */", the query gets labelled in a system table. We can then track the query in the database and see running times, what tables are in use during query execution etc.
It would be really nice to see from which Power BI the query originates and gather statistics, but I've not found any hints about adding query hints in M. I've tried searching the Net but not found anything so far.
Of course, there's always the possibility to run the query as hard coded SQL (OleDB driver property), but can it be done in M somehow?
Br,
Sören
5 Replies
- v-juanli-msftCommunity Support
Hi SorenHElisa
Do you need to add comments in M query?
If so, please add "// balabala"
https://yodalearning.com/tutorials/top-steps-to-do-comments-in-query-steps/
Best Regards
Maggie
Community Support Team _ Maggie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.- SorenHElisaHelper I
Hi Maggie,
Thanks for your response, but this was unfortunately not what I was looking for.
I need the "comment" to go down to the database, i.e. the comment need to be part of the generated SQL. So when Power BI tranlsates the qurey to be run in the database, the format should be:
select /*+ label('blahblah') */ col1 from table1;
Can this be done?
Br,
Sören
- v-juanli-msftCommunity Support
Hi SorenHElisa
When you connect to sql sever with power bi desktop, you can choose tables/columns from sql database on a pop-out window.
This would then send query like "select balabala from table bb".
Or you could write sql query in advanced statement under the connnection information.
When you import data, open Transform data, on the right pane, select one step and right-click on it, you would see "view native query" where shows sql queries sending to sql database.
Best Regards
Maggie
Community Support Team _ Maggie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- DAOSNew Member
Understanding your problem I have come to a solution and it is to connect through ODBC, creating the dns and there if you can place a query, this tutorial will summarize your doubt in a better way: https://www.vertica.com/kb/Integration-with-Microsoft-Power-BI-Connection-Guide/Content/Partner/Integration-with-Microsoft-Power-BI-Connection-Guide.htm