[R] R ORM?

Faheem Mitha faheem at email.unc.edu
Tue Nov 18 22:43:42 CET 2008


Hi Hans,

Thanks for the reply.

On Tue, 18 Nov 2008, Hans Werner Borchers wrote:

> Faheem Mitha <faheem <at> email.unc.edu> writes:
>>
>> Hi,
>>
>> Does anyone know of an R ORM (Object Relational Mapper)? I'm thinking of
>> something similar to sqlalchemy (http://www.sqlalchemy.org/).
>> Alternatively or additionally, can people offer suggestions about managing
>> relational databases from R. I'm currently using postgresql, but would
>> like a flexible solution that works across different databases, hence the
>> enquiry about ORMs.
>
> Hi Faheem,
>
> I am wondering, what kind of objects or classes you would like to
> apply the object relational mapper to. S4 classes? -- I doubt that
> very much.

Yes. R classes. As long as they support the object oriented paradigm, it 
doesn't matter too much to me what kind exactly. ORMs map between classes 
and db tables.

The attraction of an ORM is high level abstraction capabilities as well as 
a helping of syntactic sugar.

> The only reasonable structure for which one could use a mapper in R is
> the data frame. All R database packages provide support for getting
> and sending data in data frames to and from databases. Admittedly,
> this is not what someone from the Python community would accept as an
> "object relational mapper", but may be sufficient given that there is
> only this one class concerned.

You mean eg http://rpgsql.sourceforge.net/ can be used to read and write 
from a postgresql db, and there are similar packages for mysql etc.?

> The only way I know to become a somewhat independent from specific
> databases is to turn to RODBC (Windows or Linux, you didn't say that).

I use Linux (Debian). You mean 
http://cran.r-project.org/web/packages/RODBC/index.html? Is this a 
recommended approach?

CCing back to list, just in case someone else is interested...

                                                             Faheem.



More information about the R-help mailing list