Closed pbchase closed 2 years ago
Create table_sync, a function to update a DBI table accessible via a DBI connection with the output of the data_diff function (see issue #21 ) and options that indicate which of the CRUD operations should be executed.
table_sync
data_diff
sync_table <- function( conn, table, data_diff_output, insert = F, update = T, delete = F ) { # awesome stuff happens result <- list( inserts = insert_n, updates = update_n, deletes = deletes_n ) return(result) } conn <- connect_to_redcap_db() source <- read_csv("source_file.csv") target <- tbl(conn, table) %>% collect() differences <- data_diff(source, target) sync_table( conn, table, differences, insert = F, update = T, delete = F )
Addressed by PR #47
Create
table_sync
, a function to update a DBI table accessible via a DBI connection with the output of thedata_diff
function (see issue #21 ) and options that indicate which of the CRUD operations should be executed.