For how to use please see here https://github.com/WinVector/rquery/blob/master/extras/query_growth/query_growth.md.
materialize_relop_list_stages(db, collector, ..., narrow = TRUE, limit = NULL, source_limit = NULL, overwrite = TRUE, temporary = TRUE)
db | database connecton (rquery_db_info class preferred, or DBI connections). |
---|---|
collector | a rquery::relop_list |
... | force later arguments to bind by name. |
narrow | logical, if TRUE add select_columns() to narrow stages. |
limit | numeric if not NULL result limit (to use this, last statement must not have a limit). |
source_limit | numeric if not NULL limit sources to this many rows. |
overwrite | logical if TRUE drop an previous table. |
temporary | logical if TRUE try to create a temporary table. |
a rquery::relop_table_source representing ops's materialization.
if(requireNamespace("DBI", quietly = TRUE) && requireNamespace("RSQLite", quietly = TRUE) ) { rsqlite_connection <- DBI::dbConnect(RSQLite::SQLite(), ":memory:") db <- rquery_db_info( connection = rsqlite_connection, is_dbi = TRUE ) collector <- make_relop_list() d <- rq_copy_to(db, "d", data.frame(x = 1, y = 2), temporary = TRUE, overwrite = TRUE) ops1 <- d %.>% extend(., z %:=% x + y) %.>% collector ops2 <- ops1 %.>% extend(., z2 %:=% x / y) %.>% collector get_relop_list_stages(collector) res <- materialize_relop_list_stages(db, collector) res execute(db, res) DBI::dbDisconnect(rsqlite_connection) }