Please see vignette('DependencySorting', package = 'rquery')
and vignette('joinController', package= 'rquery')
for more details.
build_join_plan(tDesc, ..., check = TRUE)
description of tables from describe_tables
(and likely altered by user). Note: no column names must intersect with names of the form table_CLEANEDTABNAME_present
.
force later arguments to bind by name.
logical, if TRUE check the join plan for consistency.
detailed column join plan (appropriate for editing)
if (requireNamespace("DBI", quietly = TRUE) && requireNamespace("RSQLite", quietly = TRUE)) {
my_db <- DBI::dbConnect(RSQLite::SQLite(), ":memory:")
d <- data.frame(id=1:3, weight= c(200, 140, 98))
DBI::dbWriteTable(my_db,"d1", d)
DBI::dbWriteTable(my_db,"d2", d)
tDesc <- describe_tables(my_db, c("d1", "d2"))
tDesc$keys[[1]] <- list(PrimaryKey= 'id')
tDesc$keys[[2]] <- list(PrimaryKey= 'id')
print(build_join_plan(tDesc))
DBI::dbDisconnect(my_db)
}
#> tableName sourceColumn sourceClass resultColumn isKey want
#> id d1 id integer PrimaryKey TRUE TRUE
#> weight d1 weight numeric d1_weight FALSE TRUE
#> id1 d2 id integer PrimaryKey TRUE TRUE
#> weight1 d2 weight numeric d2_weight FALSE TRUE