Skip to content

Commit

Permalink
Fixed error when calling getTableNames() on a DuckDB connection. F…
Browse files Browse the repository at this point in the history
…ixes #299
  • Loading branch information
schuemie committed Jan 31, 2025
1 parent 0794d6e commit 24ce059
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ Bugfixes:

- Remove direct call to `bit64` S3 method to avoid issues in the future.

- Fixed error when calling `getTableNames()` on a `DuckDB` connection.


DatabaseConnector 6.4.0
=======================
Expand Down
3 changes: 2 additions & 1 deletion R/ListTables.R
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,8 @@ getTableNames <- function(connection, databaseSchema = NULL, cast = "lower") {
} else if (is(connection, "DatabaseConnectorConnection")) {
tableNames <- DBI::dbListTables(conn = connection, databaseSchema = databaseSchema)
} else if (is(connection, "PqConnection") || is(connection, "RedshiftConnection") || is(connection, "duckdb_connection")) {
stopifnot(length(databaseSchemaSplit) == 1)
databaseSchemaSplit <- strsplit(databaseSchema, "\\.")[[1]]
if (length(databaseSchemaSplit) > 1) rlang::abort("databaseSchema cannot contain a dot (.) on this platform")
sql <- paste0("SELECT table_name FROM information_schema.tables WHERE table_schema = '", databaseSchema, "';")
tableNames <- DBI::dbGetQuery(connection, sql)[["table_name"]]
} else if (is(connection, "Microsoft SQL Server")) {
Expand Down

0 comments on commit 24ce059

Please sign in to comment.