dbWriteTable-DatabaseConnectorConnection-character-data.frame-method: Copy data frames to database tables

Description Usage Arguments Value See Also

Description

Writes, overwrites or appends a data frame to a database table, optionally converting row names to a column and specifying SQL data types for fields.

\Sexpr[results=rd,stage=render]{DBI:::methods_as_rd("dbWriteTable")}

Usage

1
2
3
4
  ## S4 method for signature 'DatabaseConnectorConnection,character,data.frame'
dbWriteTable(conn,
  name, value, overwrite = FALSE, append = FALSE, temporary = FALSE,
  oracleTempSchema = NULL, ...)

Arguments

conn

A DBIConnection object, as returned by dbConnect().

name

A character string specifying the unquoted DBMS table name, or the result of a call to dbQuoteIdentifier().

value

a data.frame (or coercible to data.frame).

overwrite

Overwrite an existing table (if exists)?

append

Append to existing table?

temporary

Should the table created as a temp table?

oracleTempSchema

Specifically for Oracle, a schema with write priviliges where temp tables can be created.

...

Other parameters passed on to methods.

Value

dbWriteTable() returns TRUE, invisibly. If the table exists, and both append and overwrite arguments are unset, or append = TRUE and the data frame with the new data has different column names, an error is raised; the remote table remains unchanged.

An error is raised when calling this method for a closed or invalid connection. An error is also raised if name cannot be processed with dbQuoteIdentifier() or if this results in a non-scalar. Invalid values for the additional arguments row.names, overwrite, append, field.types, and temporary (non-scalars, unsupported data types, NA, incompatible values, duplicate or missing names, incompatible columns) also raise an error.

See Also

Other DBIConnection generics: DBIConnection-class, dbAppendTable, dbCreateTable, dbDataType, dbDisconnect, dbExecute, dbExistsTable, dbGetException, dbGetInfo, dbGetQuery, dbIsReadOnly, dbIsValid, dbListFields, dbListObjects, dbListResults, dbListTables, dbReadTable, dbRemoveTable, dbSendQuery, dbSendStatement


OHDSI/DatabaseConnector documentation built on Oct. 28, 2018, 8:02 a.m.