R query runner –

Hello,

I have written an R query runner and have been running that in our dashboard for a couple months now and it seems to work fine. It basically uses rpy2 to run R code and data is transferred as JSON strings between Python and R. Custom R functions are included to convert between R data frames and Redash’s JSON.

Is there interest in getting this included in Redash? If so, I could do a PR. The code is mostly ready, I’d just need to polish it a bit and generalize the installation of dependencies. Note that there’s no sandbox and I’m not interested in trying to hack that in, so it’d be an in your own installation at your own risk type of feature.

1 Like

We’d certainly be interested. Our experiment reporting is current in an R Shiny Dashboard. If we could bring into Redash it would be very helpful.

Thanks,
Adam

Yes, very interested to see this for myself. I’m curious to know if you encountered any major pitfalls during the query runner development.

No relevant pitfalls, rpy2 was quite simple to use. Passing data between Python and R via JSON dump and load and further in R going from JSON to a data frame and back is probably the biggest issue, but it hasn’t been a problem with the amounts of data we have in our queries. Also, the Python query runner has to a large extent the same problem, at least if you’re converting to Pandas data frame and back (https://github.com/getredash/redash/issues/2078).

If there’s no word from Redash developers, instead of a polished PR, I can just post the current code in a gist or something. That should satisfy the curious and maybe gain some helpful comments.

All right, here it is: https://gist.github.com/otsaloma/753bcca2c2465160ce9872fd7d94c836

1 Like