Learn R Programming

MonetDBLite (version 0.6.0)

src_monetdb: dplyr integration from MonetDBLite

Description

Use src_monetdb to connect to an existing MonetDB database, and tbl to connect to tables within that database. Please note that the ORDER BY, LIMIT and OFFSET keywords are not supported in the query when using tbl on a connection to a MonetDB database. If you are running a local database, you only need to define the name of the database you want to connect to.

Usage

src_monetdb(dbname, host = "localhost", port = 50000L, user = "monetdb",
  password = "monetdb", con=FALSE, ...)

src_monetdblite(dbdir = tempdir(), ...)

Arguments

dbname

Database name

host,port

Host name and port number of database (defaults to localhost:50000)

user,password

User name and password (if needed)

con

Existing DBI connection to MonetDB to be re-used

...

for the src, other arguments passed on to the underlying database connector, dbConnect.

dbdir

a directory to start MonetDBLite in

Examples

Run this code
# NOT RUN {
library(dplyr)
# To connect to a database first create a src:
dbdir <- file.path(tempdir(), "dplyrdir")
my_db <- MonetDBLite::src_monetdblite(dbdir)

# copy some data to DB
my_iris  <- copy_to(my_db, iris)

# create table object
my_iris2 <- tbl(my_db, 'iris')

# now you can call regular dplyr methods on table object

# ...

# shut down the database
MonetDBLite::monetdblite_shutdown()
# }

Run the code above in your browser using DataLab