From 1103a4b0c531bbdb5d57937976e5404743e01ede Mon Sep 17 00:00:00 2001 From: Michael Milton Date: Thu, 16 Nov 2023 13:45:44 +1100 Subject: [PATCH] Fix "Binder Error: Referenced table not found!" --- R/metadata.R | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/R/metadata.R b/R/metadata.R index ba5d8c1..5f87f85 100644 --- a/R/metadata.R +++ b/R/metadata.R @@ -64,9 +64,11 @@ SAMPLE_DATABASE_URL <- single_line_str( #' #' @importFrom DBI dbConnect #' @importFrom duckdb duckdb +#' @importFrom dbplyr sql #' @importFrom dplyr tbl #' @importFrom httr progress #' @importFrom cli cli_alert_info hash_sha256 +#' @importFrom glue glue #' #' @details #' @@ -162,10 +164,13 @@ get_metadata <- function( progress(type = "down", con = stderr()) ) } - + + # Since dbplyr 2.4.0, raw file paths aren't handled very well + # See: https://github.com/duckdb/duckdb-r/issues/38 + select <- glue("FROM read_parquet('{db_path}')") |> sql() table <- duckdb() |> dbConnect(drv = _, read_only = TRUE) |> - tbl(db_path) + tbl(select) cache$metadata_table[[hash]] <- table table }