Skip to content

Commit

Permalink
Use workaround to avoid duckdb raising unnecessary warning
Browse files Browse the repository at this point in the history
  • Loading branch information
r-ash committed Mar 20, 2024
1 parent f3ef05f commit f15a7e2
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion R/outputs.R
Original file line number Diff line number Diff line change
Expand Up @@ -1355,7 +1355,7 @@ read_hintr_output <- function(path) {
}

read_duckdb <- function(path) {
con <- DBI::dbConnect(duckdb::duckdb(), dbdir = path, read_only = TRUE)
con <- DBI::dbConnect(duckdb::duckdb(dbdir = path, read_only = TRUE))
on.exit(DBI::dbDisconnect(con, shutdown = TRUE))
DBI::dbGetQuery(con, sprintf("SELECT * from %s", DUCKDB_OUTPUT_TABLE_NAME))
}
Expand Down
4 changes: 2 additions & 2 deletions R/run-model.R
Original file line number Diff line number Diff line change
Expand Up @@ -149,9 +149,9 @@ hintr_save <- function(obj, file) {
stop(paste("Trying to save invalid object as duckdb database.",
"Only data frames can be saved as database."))
}
con <- DBI::dbConnect(duckdb::duckdb(), dbdir = file)
con <- DBI::dbConnect(duckdb::duckdb(dbdir = file))
on.exit(DBI::dbDisconnect(con, shutdown = TRUE))
DBI::dbWriteTable(con, DUCKDB_OUTPUT_TABLE_NAME, obj)
DBI::dbDisconnect(con, shutdown = TRUE)
} else {
stop(sprintf("Cannot save as type '%s', must be 'qs' or 'duckdb'.", type))
}
Expand Down

0 comments on commit f15a7e2

Please sign in to comment.