README.md

A convenience R6 class framework around DBI

Status

Project Status:
WIP. cran
checks Codecov

lines of R code: 261, lines of test code: 73

Package Info

Version

0.1.3 ( 2018-10-31 14:49:32 )

Description

A convenience R6 class framework around DBI that provides classes for connection, db, table, … with methods around SQL verbs create, insert, update, delete, select, … and many more.

License

MIT + file LICENSE Peter Meissner [aut, cre], [ctb]

Installation

Stable version from CRAN:

install.packages("db6")

Latest development version from Github:

devtools::install_github("petermeissner/db6")

Objects

db : A representation of a database within R. The object allows to get information about the database and objects stored in it (tables and such), to retrieve objects from it, and to manipulate it via queries and convenience methods.

db_con : The heart and work horse of all db objects and responsible for the actual information flow between R and the database with methods for connect, disconnect, reconnect, querying, and manipulating the database.

tb_table : A representation of a database table with particular methods to interact with tables - create, delete, append, copy, retrieve, filter, peak, and update.

Connections

loading packages

# packages
library(RSQLite)
library(db6)

A New Connection Object

# creating con object
db_con <- new_db_con(drv_fun = SQLite, ":memory:")

Connection Infos

# connection infos
db_con$con

## <SQLiteConnection>
##   Path: :memory:
##   Extensions: TRUE

db_con$info()

## $class
## [1] "SQLiteConnection"
## 
## $dbname
## [1] ":memory:"

Auto Reconnect on Stale Connections

# Auto reconnect
db_con$disconnect()
db_con$con

## <SQLiteConnection>
##   Path: :memory:
##   Extensions: TRUE

db_con$info()

## $class
## [1] "SQLiteConnection"
## 
## $dbname
## [1] ":memory:"

db_con$con

## <SQLiteConnection>
##   Path: :memory:
##   Extensions: TRUE


petermeissner/db6 documentation built on May 17, 2019, 8:21 a.m.