From af34eb8ffc3714b517494082ab2f381c25489fc3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rasmus=20Skytte=20Randl=C3=B8v?= Date: Fri, 26 Jul 2024 10:44:58 +0200 Subject: [PATCH] fix(Logger): Write catalog to logs if it is supported by the backend --- R/Logger.R | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/R/Logger.R b/R/Logger.R index dd3d3b7e..a96b4259 100644 --- a/R/Logger.R +++ b/R/Logger.R @@ -330,10 +330,18 @@ Logger <- R6::R6Class( assert_timestamp_like(self$start_time, add = coll) checkmate::reportAssertions(coll) - patch <- purrr::pluck(private$db_table, "name") |> - tibble::enframe() |> - tidyr::pivot_wider() |> - dplyr::mutate(log_file = self$log_filename) |> + patch <- data.frame( + log_file = self$log_filename, + schema = purrr::pluck(private$db_table, "name", "schema"), + table = purrr::pluck(private$db_table, "name", "table") + ) + + # Add catalog if it exists in the Id + if ("catalog" %in% purrr::pluck(private$db_table, "name", names)) { + patch <- dplyr::mutate(patch, catalog = purrr::pluck(private$db_table, "name", "catalog"), .before = "schema") + } + + patch <- patch |> dplyr::copy_to( dest = private$log_conn, df = _,