Skip to content
This repository has been archived by the owner on May 19, 2021. It is now read-only.

Simplify access to Google Cloud SQL (i.e. fun with Go!) #70

Open
michaelquinn32 opened this issue May 8, 2017 · 3 comments
Open

Simplify access to Google Cloud SQL (i.e. fun with Go!) #70

michaelquinn32 opened this issue May 8, 2017 · 3 comments

Comments

@michaelquinn32
Copy link

michaelquinn32 commented May 8, 2017

This blog post details the process for connecting to a Google Cloud SQL instance:
https://cloud.google.com/blog/big-data/2017/03/google-cloud-platform-for-data-scientists-using-r-with-google-cloud-sql-for-mysql

In short, it involves:

It would be awesome to handle all of this seamlessly within R.

From what I understand about each step, working with the Go tool will be the most interesting. More recent versions of Go have cgo. It might be possible to use this for creating R extensions with Go.

https://golang.org/cmd/cgo/

(An example of combining C and Go)
http://blog.ralch.com/tutorial/golang-sharing-libraries/

At the very least, there's some other examples of doing something like this in Ruby.
http://blog.paracode.com/2015/08/28/ruby-and-go-sitting-in-a-tree/
https://github.com/jondot/scatter

I don't nearly enough about the Ruby (or R) internals to know if this is applicable, but I think it'd be pretty cool if we could get this to work!

@jimhester
Copy link
Contributor

https://romain.rbind.io/blog/2017/05/14/calling-go-from-r/ is relevant to this, however the problem in my mind isn't how you call the go shared library from R but how you distribute the package. CRAN is not going to provide go binaries so you would need users to have the go compiler installed, which most R users will not have.

@cboettig
Copy link
Member

Possibly related: rstudio/blogdown depends on a Go binary and just uses a user-called function to grab/ install the correct binary for your system (from a GitHub release page for those binaries)

@michaelquinn32
Copy link
Author

@jimhester Thanks for the heads up on the Romain blog post. I was working through the exact same thing, and it's so great to see that this is really possible!

@cboettig Thanks for the suggestion! I'd be happy to go that route too. Just to keep everything together, the hugo installer is here:
https://github.com/rstudio/blogdown/blob/5f84d8e980cf8918bafe116dbb339f9783d1b9f2/R/install.R

And the api around the binary is here:
https://github.com/rstudio/blogdown/blob/master/R/hugo.R

Either way, it sounds like this might not be eligible for CRAN. I don't consider that too much of a loss.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants