dbxUpsert: Upsert records

View source: R/upsert.R

dbxUpsertR Documentation

Upsert records

Description

Upsert records

Usage

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

## 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 June 22, 2024, 9:11 a.m.