Skip to content

This is a helper function that retrieves the most recent SQL query generated by dbplyr, which can be useful for debugging.

Usage

last_sql()

Value

A SQL string, or NULL if no query has been generated yet.

Examples

library(dplyr, warn.conflicts = FALSE)

df <- lazy_frame(x = 1:3)
df |> filter(x > 1)
#> <SQL>
#> SELECT "df".*
#> FROM "df"
#> WHERE ("x" > 1.0)

last_sql()
#> <SQL> SELECT "df".*
#> FROM "df"
#> WHERE ("x" > 1.0)