Description Usage Arguments Value Examples
Depends on igraph
package.
Please see vignette('DependencySorting', package = 'replyr')
and vignette('joinController', package= 'replyr')
for more details.
1 | topoSortTables(columnJoinPlan, leftTableName, ...)
|
columnJoinPlan |
join plan |
leftTableName |
which table is left |
... |
force later arguments to bind by name |
list with dependencyGraph and sorted columnJoinPlan
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | if (requireNamespace("RSQLite", quietly = TRUE)) {
# note: employeeanddate is likely built as a cross-product
# join of an employee table and set of dates of interest
# before getting to the join controller step. We call
# such a table "row control" or "experimental design."
my_db <- DBI::dbConnect(RSQLite::SQLite(), ":memory:")
RSQLite::initExtension(my_db)
tDesc <- example_employeeAndDate(my_db)
columnJoinPlan <- buildJoinPlan(tDesc, check= FALSE)
# unify keys
columnJoinPlan$resultColumn[columnJoinPlan$resultColumn=='id'] <- 'eid'
# look at plan defects
print(paste('problems:',
inspectDescrAndJoinPlan(tDesc, columnJoinPlan)))
# fix plan
if(requireNamespace('igraph', quietly = TRUE)) {
sorted <- topoSortTables(columnJoinPlan, 'employeeanddate')
print(paste('problems:',
inspectDescrAndJoinPlan(tDesc, sorted$columnJoinPlan)))
# plot(sorted$dependencyGraph)
}
DBI::dbDisconnect(my_db)
my_db <- NULL
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.