
Show the SQL that would be executed by ducklake operations
Source:R/show_ducklake_query.R
show_ducklake_query.RdPrints 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.
See also
Other table operations:
add_data_files(),
create_schema(),
create_table(),
create_view(),
drop_schema(),
drop_view(),
ducklake_exec(),
get_ducklake_table(),
get_metadata_table(),
list_ducklake_tables(),
replace_table()
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)