Skip to contents

Prints the statement ducklake_exec() would run for a pipeline, without running it. Like dplyr::show_query(), the SQL is written to the console and the input is returned invisibly, so it can sit in the middle of a pipe.

Usage

show_ducklake_query(.data, table_name = NULL)

Arguments

.data

A dplyr query object (tbl_lazy)

table_name

The target table name for the operation. If not provided, will be extracted from the table attribute (set by get_ducklake_table())

Value

The first argument, invisibly (following show_query convention)

Examples

lake_dir <- tempfile("sql_lake_")
dir.create(lake_dir)
attach_ducklake("sql_lake", lake_path = lake_dir)
create_table(mtcars, "cars")

# Show SQL for an update operation (table name inferred)
get_ducklake_table("cars") |>
  dplyr::mutate(gear = 5) |>
  show_ducklake_query()
#> -- DuckLake SQL preview
#> UPDATE cars SET gear = 5.0;

detach_ducklake("sql_lake", shutdown = TRUE)
unlink(lake_dir, recursive = TRUE)