rq_copy_to: Copy local R table to remote data handle.

View source: R/db_ops.R

rq_copy_toR Documentation

Copy local R table to remote data handle.

Description

Copy local R table to remote data handle.

Usage

rq_copy_to(
  db,
  table_name,
  d,
  ...,
  qualifiers = NULL,
  overwrite = FALSE,
  temporary = TRUE,
  rowidcolumn = NULL
)

Arguments

db

database connection handle.

table_name

name of table to create.

d

data.frame to copy to database.

...

force later argument to be by name

qualifiers

optional named ordered vector of strings carrying additional db hierarchy terms, such as schema.

overwrite

logical, if TRUE try to overwrite existing table.

temporary

logical, if TRUE try to mark table as temporary.

rowidcolumn

character, name to land row-ids.

Value

a relop representation of the data

See Also

db_td, mk_td, materialize, execute, to_sql

Examples


if (requireNamespace("DBI", quietly = TRUE) && requireNamespace("RSQLite", quietly = TRUE)) {
  db <- DBI::dbConnect(RSQLite::SQLite(), ":memory:")
  d <- rq_copy_to(db, 'd',
                   data.frame(AUC = 0.6, R2 = 0.2))

  sql <- to_sql(d, db)
  cat(sql)
  print(DBI::dbGetQuery(db, "SELECT * FROM d"))
  DBI::dbDisconnect(db)
}


rquery documentation built on Aug. 20, 2023, 9:06 a.m.