dbxUpsert: Upsert records

Description Usage Arguments Examples

View source: R/upsert.R

Description

Upsert records

Usage

1
2
3
4
5
6
7
8
9
dbxUpsert(
  conn,
  table,
  records,
  where_cols,
  batch_size = NULL,
  returning = NULL,
  skip_existing = FALSE
)

Arguments

conn

A DBIConnection object

table

The table name to upsert

records

A data frame of records to upsert

where_cols

The columns to use for WHERE clause

batch_size

The number of records to upsert in a single statement (defaults to all)

returning

Columns to return

skip_existing

Skip existing rows

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
## Not run: 

db <- dbxConnect(adapter="postgres", dbname="dbx")
table <- "forecasts"
DBI::dbCreateTable(db, table, data.frame(id=1:3, temperature=20:22))

records <- data.frame(id=c(3, 4), temperature=c(20, 25))
dbxUpsert(db, table, records, where_cols=c("id"))

## End(Not run)

dbx documentation built on Jan. 17, 2021, 9:06 a.m.