Add to last argument and pass all others through.
to_sql( x, db, ..., limit = NULL, source_limit = NULL, indent_level = 0, tnum = mk_tmp_name_source("tsql"), append_cr = TRUE, using = NULL )Arguments x
rquery operation tree.
dbDBI database handle or rquery_db_info object.
...generic additional arguments (not used).
limitnumeric if not NULL limit result to this many rows.
source_limitnumeric if not NULL limit sources to this many rows.
indent_levellevel to indent.
tnumtemp sub-query name generator.
append_crlogical if TRUE end with CR.
usingcharacter, if not NULL set of columns used from above.
ValueSQL command
See alsodb_td
, materialize
, execute
, rq_copy_to
, mk_td
if (requireNamespace("DBI", quietly
= TRUE) && requireNamespace("RSQLite", quietly
= TRUE)) { my_db <- DBI::dbConnect(RSQLite::SQLite(),
":memory:") d1 <- rq_copy_to(my_db,
'd1',
data.frame(AUC
= 0.6, R2
= 0.2)) d2 <- rq_copy_to(my_db,
'd2',
data.frame(AUC
= 0.6, D
= 0.3)) optree <- natural_join(d1,
d2, by
= "AUC") cat(format(optree)) print(to_sql(optree,
my_db)) DBI::dbDisconnect(my_db) }#> mk_td("d1", c( #> "AUC", #> "R2")) %.>% #> natural_join(., #> mk_td("d2", c( #> "AUC", #> "D")), #> jointype = "INNER", by = c('AUC')) #> [1] "SELECT\n COALESCE(`tsql_01506056589604590114_0000000000`.`AUC`, `tsql_01506056589604590114_0000000001`.`AUC`) AS `AUC`,\n `tsql_01506056589604590114_0000000000`.`R2` AS `R2`,\n `tsql_01506056589604590114_0000000001`.`D` AS `D`\nFROM (\n SELECT\n `AUC`,\n `R2`\n FROM\n `d1`\n) `tsql_01506056589604590114_0000000000`\nINNER JOIN (\n SELECT\n `AUC`,\n `D`\n FROM\n `d2`\n) `tsql_01506056589604590114_0000000001`\nON\n `tsql_01506056589604590114_0000000000`.`AUC` = `tsql_01506056589604590114_0000000001`.`AUC`\n"
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4