Forum Discussion
Desktop dynamic mysql query with parameters works; In service DOES NOT
Hi Anonymous ,
Please take a look at this blog for reference.
https://www.excelguru.ca/blog/2015/03/11/power-query-errors-please-rebuild-this-data-combination/
Did I answer your question ? Please mark my reply as solution. Thank you very much.
If not, please upload some insensitive data samples and expected output.
Best Regards,
Eyelyn Qin
- Anonymous5 years agoNot applicable
Thanks Eyelyn but the article seems to be not so clear with regards to my situation. The post you provided is Excel and mine issue is with MySQL.
Furthermore, my primary point is that the desktop version allows my query without issue. It only is the service that the problem presents itself. Makes me think that the code or parser on the service is either more strict or has not been updated to reflect the desktop.
Your post states the combine problem comes about when there is an “External Data Source” and “Another Query”. I ask, which is the “Another Query” in my query? I only have 1 SQL query albeit, it’s dynamic. Could it be that the mere fact that the variable DimShipper is introduce makes the service parser believe that is the "Another Query"? Just because it's a variable???
If so, I can not circumvent this because I have then 2 “Another Queries”. I have the “table_name” and the “hour” which is necessary for the sql. I have made a workaround by creating a dynamic view that the user updates on a separate CGI page I made but I would like to find out what specifically is wrong or if it is indeed a code update that needs to take place on the service.
The other “functions” by the way I use after the Source assignment are as follows:
Table.DuplicateColumn
Table.RemoveColumns
Table.RenameColumns
Table.ReplaceValue
Table.Sort
Table.SplitColumn
Table.TransformColumnTypes
Any further suggestions or insights would be greatly appreciated but I think my issue is not apples to apples at least with that Excel post and the issue being the discrepancy between the desktop version and servcie The service and desktop, in my opinion, should have the same behavior.
Thanks!
Bryant
- Anonymous5 years agoNot applicable
Okay, I narrowed it down that the service does not allow a parameter as the table. I removed all other functions and only have the below which still has the combine error. It does not like that I concatenate the date parameter with the prefix of the table name. I need that though because it is the only way to allow the user to select the desired table. My workaround in case anyone is interest was just put a cgi page that allows the date to be selected then I dynamically CREATE OR REPLACE VIEW and use that view in the query.
I think that the code on the service needs updating and is not in sync with the desktop being too restrictive here.
let
sql_query = "SELECT * #(lf)FROM HistoryTable_" & date & " #(lf)WHERE DATE_FORMAT(FROM_UNIXTIME(lms), ""%i"") = '00' #(lf)AND DATE_FORMAT(FROM_UNIXTIME(lms), ""%H"") in ('00')",
Source = MySQL.Database("mydb.fakedomain.net", "mydb", [ReturnSingleDatabase=true, Query=sql_query])in
Source
Thanks,
Bryant
- Anonymous5 years agoNot applicable
Hi Anonymous ,
Hope these help😀
Best Regards,
Eyelyn Qin