Merge local data frame into SQL table

db_merge_into(values, table, con, by = NULL, drop = FALSE, ...)

Arguments

values

`data.frame` of values to write to SQL database

table

Name of target SQL table, as character

con

database connection object

by

Character vector of columns by which to perform merge. Defaults to all columns in `values`

drop

logical. If `TRUE` (default), drop columns not found in SQL table.

...

Arguments passed on to insert_table

values

`data.frame` of values to write to SQL database

table

Name of target SQL table, as character

coerce_col_class

logical, whether or not to coerce local data columns to SQL classes. Default = `TRUE.`

drop

logical. If `TRUE` (default), drop columns not found in SQL table.

con

database connection object

Value

Data frame: Inner join of SQL table and input data frame (as unevaluated "lazy query" table)

Examples

# NOT RUN {
irisdb <- DBI::dbConnect(RSQLite::SQLite(), ":memory:")
dplyr::copy_to(irisdb, iris[1:10,], name = "iris", overwrite = TRUE)
db_merge_into(iris[1:12,], "iris", irisdb)
dplyr::tbl(irisdb, "iris") %>% dplyr::count()
# }