You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
library(glue)
con<-DBI::dbConnect(RSQLite::SQLite(), ":memory:")
# I like thisx<- c("a", "b")
glue_sql("SELECT {`x`*} FROM TABLE1", .con=con)
#> <SQL> SELECT `a`, `b` FROM TABLE1# But we also have thisy<- setNames(x, c("A", "B"))
glue_sql("SELECT {`y`*} FROM TABLE1", .con=con)
#> <SQL> SELECT `a`, `b` FROM TABLE1# And I wish it would translate to#> <SQL> SELECT `a` `A`, `b` `B` FROM TABLE1# tedious workaroundselected<- toString(paste(glue_sql("{`y`}", .con=con), glue_sql("{`names(y)`}", .con=con)))
glue_sql("SELECT ", selected, " FROM TABLE1", .con=con)
#> <SQL> SELECT `a` `A`, `b` `B` FROM TABLE1
I don't see an obvious way to do this as I'm pretty sure we'll need different variants for different SQL dialects, and DBI::dbQuoteIdentifier() ignores names:
Created on 2022-08-31 by the reprex package (v2.0.1)
It's a breaking change but maybe worth it ? Or have a
named_to_alias = FALSE
arg that we might switch on for this behaviour ?The text was updated successfully, but these errors were encountered: