-
Notifications
You must be signed in to change notification settings - Fork 187
Closed
Description
Postgres-backend includes a format argument to the sql_query_explain -method. However, that argument never survives to the function, and default value is always used. This is very restrictive for the backends that would benefit for passing arguments to the method.
To demonstrate the issue, the following reprex changes the sql_query_explain -method of SQLiteConnection so that the value of the argument becomes visible.
library(dplyr, warn.conflicts = FALSE)
library(dbplyr, warn.conflicts = FALSE)
# Adding format argument (from Postgres explain) to SQLite explain
sql_query_explain.SQLiteConnection <- function(con, sql, format = "text", ...) {
dbplyr:::cat_line("Parameter 'format' with value: ", format)
build_sql("EXPLAIN QUERY PLAN ", sql, con = con)
}
assignInNamespace("sql_query_explain.SQLiteConnection", sql_query_explain.SQLiteConnection, ns = "dbplyr")
con = DBI::dbConnect(RSQLite::SQLite(), ":memory:")
df <- copy_to(con, tibble(x=1))
df %>% explain(format="json") # Value below should be: json
#> <SQL>
#> SELECT *
#> FROM `tibble(x = 1)`
#>
#> <PLAN>
#> Parameter 'format' with value: text
#> id parent notused detail
#> 1 2 0 0 SCAN tibble(x = 1)
DBI::dbDisconnect(con)Created on 2022-02-18 by the reprex package (v2.0.1.9000)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels