Skip to content

Commit

Permalink
Merge pull request #254 from egillax/duckdb_pathToDriver
Browse files Browse the repository at this point in the history
Duckdb path to driver
  • Loading branch information
schuemie committed Oct 21, 2023
2 parents 20c66bd + 57dbb72 commit c0d05d6
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion R/Drivers.R
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ getJbcDriverSingleton <- function(driverClass = "", classPath = "") {
}

checkPathToDriver <- function(pathToDriver, dbms) {
if (!is.null(dbms) && dbms %in% c("sqlite", "sqlite extended")) {
if (!is.null(dbms) && dbms %in% c("sqlite", "sqlite extended", "duckdb")) {
return()
}
if (pathToDriver == "") {
Expand Down
14 changes: 14 additions & 0 deletions tests/testthat/test-duckdb.R
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,20 @@ test_that("Open and close duckdb connection", {
unlink(databaseFile)
})

test_that("Open and close duckdb without DATABASECONNECTOR_JAR_FOLDER", {
withr::with_envvar(
new=c("DATABASECONNECTOR_JAR_FOLDER"=""),
{
databaseFile <- tempfile()
connection <- DatabaseConnector::connect(dbms = "duckdb", server = databaseFile)
expect_s4_class(connection, "DatabaseConnectorDbiConnection")
disconnect(connection)
unlink(databaseFile)
}

)
})

test_that("Insert and retrieve dates from duckdb", {
databaseFile <- tempfile()
connection <- DatabaseConnector::connect(dbms = "duckdb", server = databaseFile)
Expand Down

0 comments on commit c0d05d6

Please sign in to comment.