[R-sig-DB] Parameterised queries

Hadley Wickham h@w|ckh@m @end|ng |rom gm@||@com
Thu Feb 12 17:48:24 CET 2015


>> PL/R is able to pull vectors in from R, though RPostgreSQL cannot pulls
>> arrays from PostgreSQL as vectors (though it would be great to have this
>> feature).
>>
>
> I've forgotten how DBI works, but an array should just come through in text
> form and you can parse it how ever you want on the R side. You can also
> send an array by converting it to a string of the appropriate format.
>
> rpg has a 'format_for_send' method that you can dispatch on any type to
> convert it to something PostgreSQL can read. I'm working on something for
> formatting strings returned from the server.

I've started thinking about a general interface for DBI to do this
too. It's particularly important for SQLite since it has such limited
type information.

Ian, if you'd like RPostgres (https://github.com/rstats-db/RPostgres)
to support arrays natively, please file an issue describing your use
case and providing a reproducible example that creates a table with
array data.

Hadley

-- 
http://had.co.nz/




More information about the R-sig-DB mailing list