I have to query a MySQL database. There seem to be two options in Power Query either From Database --> From MySQL database or From Other Sources - From ODBC.
My question is which of the above options is the best to use? I tried the first option and I get a message saying that the connector requires additional components to be installed. I haven't progressed that any further currently.
I then installed the ODBC driver and tried that route. The issue I have here is that I can connect to the database and see the tables however when I click on one of the tables I get an error message as follows in the data preview window:
DataSource.Error: ODBC: ERROR [42000] [ma-3.2.4][10.5.27-MariaDB-log]You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'ORDER BY FKTABLE_CAT, FKTABLE_SCHEM, FKTABLE_NAME, KEY_SEQ, PKTABLE_NAME' at line 1
Details:
DataSourceKind=Odbc
DataSourcePath=dsn=sitepadsandbox
OdbcErrors=
When you select the ODBC option you specify the data source name and then can select Advanced Options and it allows you to input a SQL statement. If I enter a statement like "select * from Table_Invoices" then it will return the data without the above error message.
However I am not great at SQL statements, I can do very simple ones but need to create joins and add criteria so get the data I need. The old MS Query was useful for me as it was a visual tool that allowed me to do this and then if I needed it I could copy the SQL statements. Microsoft have removed this from main product and I suspect will make it obsolete at some point, are there any similar tools that anyone knows of that do something similar?
I would use the MySQL Database connector. This will allow you to have Power Query write the SQL for you and leverage query folding which pushes the work back to the SQL server.
When you enter a SQL statement in the Advanced Options, this shifts the processing of the query to your own PC and that is typically significantly slower than pushing the processing back to the SQL server, which has way more processing power.