Forum Discussion
R visual connecting to MySQL database
Hi,
In summary, I need to be able to connect to a database trought an R visual in power BI service. My code works in the desktop but in the service it doesnt work anymore. When I use the IP adress I have the following error: [ DBI Error in .local(drv, ...) : Failed to connect to database: Error: Can't connect to MySQL server on '(ip adress)' (0) ]
When I use the host name I have the following error: [ DBI Error in .local(drv, ...) : Failed to connect to database: Error: Unknown MySQL Server Host '(host name)' (11001) ]
Further explanation:
My objective is to create a custom R visual in power BI and publish my report with it on power BI service. My visual, is similar to a heat map, but diferent enough that the ones availabe in the store (heatmap, mapbox, esri, etc) don't work for me.
For this map I need both my data points and data from a shapefile. I tried importing both data to power bi but R only accepts 1 dataframe. Joining both tables in power BI doesn´t make that much sense and PowerBI limits it to the top 150k rows (the SHP has 3M rows). As a workaround , that worked in the desktop version, I would like to grab the Shapefile data from a database directly from my R code with dbConnect and fetch (DBI package that is accepted).
I'm open to both alternatives to solve this problem or a way to fix this issue, if it is possible
Thank you in advance
6 Replies
- zoloturuMemorable Member
Hi Pedro-Pereira,
R scripts are not supported in a web version of Power BI currently. You can vote for this idea here - https://ideas.powerbi.com/forums/265200-power-bi-ideas/suggestions/17899522-support-r-visuals-to-publish-to-web
Regards,
Ruslan
-------------------------------------------------------------------
Did I answer your question? Mark my post as a solution!- Pedro-PereiraAdvocate I
Hi Ruslan ( zoloturu ) , thanks for your reply
That vote seems to be a really interesting feature to add to power BI. However, I wasn't looking that further ahead. Right now I only need my R visual to work on app.powerbi.com. I tested some simple visuals and they work but my complex ones only work on desktop.
Do you understand my problem and if so do you know how to fix it?Also can you please tell me where did you get the idea that I wanted to "publish to web" so that I can edit my post to not confuse other people.
Best regards
Pedro
- zoloturuMemorable Member
Hi Pedro-Pereira,
Sorry, I missed that R is supported already in Service. I've checked that for you. Here is a link - https://docs.microsoft.com/en-us/power-bi/visuals/service-r-visuals, where you can find all the limitations.
And going further you can find that:
Note that in the service not all of the R packages are supported. See supported packages at the end of this article for the list of packages currently supported in the Power BI service.
And the link with a full list of supported packages in Power BI Service - https://docs.microsoft.com/en-us/power-bi/service-r-packages-support
Please go through both links and check whether you ran into the limits or not.
Regards,
Ruslan
-------------------------------------------------------------------
Did I answer your question? Mark my post as a solution!