R/DBI.R
dbWriteTable-DatabaseConnectorConnection-character-data.frame-method.Rd
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.
New code should prefer dbCreateTable()
and dbAppendTable()
.
# S4 method for DatabaseConnectorConnection,character,data.frame
dbWriteTable(
conn,
name,
value,
overwrite = FALSE,
append = FALSE,
temporary = FALSE,
oracleTempSchema = NULL,
tempEmulationSchema = getOption("sqlRenderTempEmulationSchema"),
...
)
A DBIConnection object, as returned by
dbConnect()
.
A character string specifying the unquoted DBMS table name,
or the result of a call to dbQuoteIdentifier()
.
a data.frame (or coercible to data.frame).
Overwrite an existing table (if exists)?
Append to existing table?
Should the table created as a temp table?
DEPRECATED: use tempEmulationSchema
instead.
Some database platforms like Oracle and Impala do not truly support temp tables. To emulate temp tables, provide a schema with write privileges where temp tables can be created.
Other parameters passed on to methods.
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.
Other DBIConnection generics:
DBIConnection-class
,
dbAppendTable()
,
dbCreateTable()
,
dbDataType()
,
dbDisconnect()
,
dbExecute()
,
dbExistsTable()
,
dbGetException()
,
dbGetInfo()
,
dbGetQuery()
,
dbIsReadOnly()
,
dbIsValid()
,
dbListFields()
,
dbListObjects()
,
dbListResults()
,
dbListTables()
,
dbReadTable()
,
dbRemoveTable()
,
dbSendQuery()
,
dbSendStatement()