Changeset: 88625ec9c584 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=88625ec9c584
Modified Files:
clients/R/MonetDB.R/NEWS
clients/R/MonetDB.R/R/dplyr.R
clients/R/MonetDB.R/man/src_monetdb.Rd
Branch: embedded
Log Message:
R Connector: src_monetdb now can use an existing DBI connection
diffs (49 lines):
diff --git a/clients/R/MonetDB.R/NEWS b/clients/R/MonetDB.R/NEWS
--- a/clients/R/MonetDB.R/NEWS
+++ b/clients/R/MonetDB.R/NEWS
@@ -15,6 +15,7 @@ 1.0.0
- Initial support for running MonetDB in embedded mode (MonetDBLite)
- Now re-establishing connection if interrupt (CMD-C or ESC) occurs
- Fixed a bug in monetdb.read.csv for multiple CSV files without headers
+- dplyr src_monetdb now has a con parameter to pass an existing DBI connection
0.9.7
- Fixed crash on Windows (Sorry, everyone)
diff --git a/clients/R/MonetDB.R/R/dplyr.R b/clients/R/MonetDB.R/R/dplyr.R
--- a/clients/R/MonetDB.R/R/dplyr.R
+++ b/clients/R/MonetDB.R/R/dplyr.R
@@ -1,8 +1,10 @@
src_monetdb <- function(dbname, host = "localhost", port = 50000L, user =
"monetdb",
- password = "monetdb", ...) {
+ password = "monetdb", con = FALSE, ...) {
+ if (!inherits(con, "MonetDBConnection") || !dbIsValid(con)) {
+ con <- dbConnect(MonetDB.R(), dbname = dbname , host = host, port = port,
+ user = user, password = password, ...)
+ }
requireNamespace("dplyr")
- con <- dbConnect(MonetDB.R(), dbname = dbname , host = host, port = port,
- user = user, password = password, ...)
dplyr::src_sql("monetdb", con, info = dbGetInfo(con))
}
diff --git a/clients/R/MonetDB.R/man/src_monetdb.Rd
b/clients/R/MonetDB.R/man/src_monetdb.Rd
--- a/clients/R/MonetDB.R/man/src_monetdb.Rd
+++ b/clients/R/MonetDB.R/man/src_monetdb.Rd
@@ -18,7 +18,7 @@
\title{dplyr integration from MonetDB.R}
\usage{
src_monetdb(dbname, host = "localhost", port = 50000L, user = "monetdb",
- password = "monetdb", ...)
+ password = "monetdb", con=FALSE, ...)
\method{tbl}{src_monetdb}(src, from, ...)
}
@@ -29,6 +29,8 @@ src_monetdb(dbname, host = "localhost",
\item{user,password}{User name and password (if needed)}
+\item{con}{Existing DBI connection to MonetDB to be re-used}
+
\item{...}{for the src, other arguments passed on to the underlying
database connector, \code{dbConnect}.}
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list