gadget-framework/mfdb

dplyr integration

Closed this issue · 4 comments

dplyr can connect direct to a postgres database

http://www.inside-r.org/node/230634

Provide some kind of adapter to get a dplyr object from an MFDB one?

Is there any facility to work with lookup tables (pretty essential if dplyr is to be used on the MFDB schema)?

bthe commented

It should be trivial to connect to mfdb using:

## connect
db <- src_postgres('mf') 
## query database
tbl(db,sql('casestudy.samples')) %>% 
    left_join(tbl(db,sql('casestudy.species')) 

We have been playing around with connecting dplyr and MRI's oracle database (see github.com/fishvice/mar) and this works pretty well. The question is whether the table structure stable enough for the user to directly query the tables?

So pre-generated queries for each table, joining to lookup tables for you.

https://github.com/fishvice/mar/blob/master/R/fiskar.R#L229

There are now adaptors for the main tables, have a look at the above commit.

Let me know how it works out.

bthe commented

This starting to become very useful, thanks.