R's common database interface, implemented by backends for PostgreSQL, MySQL, SQLite, ODBC and more
open sourceLGPL-2.1-or-laterfree
DBI is R's database interface: a set of virtual classes and generics, similar in spirit to Perl's DBI, Java's JDBC and Python's DB-API, that R code uses to connect to a database, run statements, fetch results, read metadata and manage transactions. Backends such as RPostgres, RMariaDB, RSQLite, odbc and bigrquery implement it, so the same code works against different databases; most users get DBI installed with one of them. Its specification is written down in a vignette and tested by the DBItest package, and it depends only on R and the methods package.
Problems it solves
- query a PostgreSQL or MySQL database from R
- write R code that works with several databases without changing it
- read a database table into an R data frame
Features
- connect, execute statements and fetch results through one interface
- dbGetQuery, dbReadTable, dbWriteTable and dbWithTransaction
- database metadata such as tables and fields
- written specification, tested by DBItest
- no dependencies beyond R and the methods package
Limitations
- Doesn't talk to a database itself: it needs a backend package such as RPostgres, RSQLite or odbc1
