If the table exists, and both
overwrite arguments are unset,
append = TRUE and the data frame with the new data has different
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
name cannot be processed with
or if this results in a non-scalar.
Invalid values for the additional arguments
unsupported data types,
or missing names,
also raise an error.
The following arguments are not part of the
(to improve compatibility across backends)
but are part of the DBI specification:
They must be provided as named arguments. See the "Specification" and "Value" sections for details on their usage.
name argument is processed as follows,
to support databases that allow non-syntactic names for their objects:
If an unquoted table name as string:
dbWriteTable()will do the quoting, perhaps by calling
dbQuoteIdentifier(conn, x = name)
If the result of a call to
dbQuoteIdentifier(): no more quoting is done
overwrite argument is
TRUE, an existing table of the same name
will be overwritten.
This argument doesn't change behavior if the table does not exist yet.
append argument is
TRUE, the rows in an existing table are
preserved, and the new data are appended.
If the table doesn't exist yet, it is created.
temporary argument is
TRUE, the table is not available in a
second connection and is gone after reconnecting.
Not all backends support this argument.
A regular, non-temporary table is visible in a second connection
and after reconnecting to the database.
SQL keywords can be used freely in table names, column names, and data. Quotes, commas, and spaces can also be used in the data, and, if the database supports non-syntactic identifiers, also for table names and column names.
The following data types must be supported at least,
and be read identically with
numeric (also with
NaNvalues, the latter are translated to
64-bit values (using
"bigint"as field type); the result can be converted to a numeric, which may lose precision,
character (in both UTF-8 and native encodings), supporting empty strings
factor (returned as character)
list of raw (if supported by the database)
objects of type blob::blob (if supported by the database)
date (if supported by the database; returned as
time (if supported by the database; returned as objects that inherit from
timestamp (if supported by the database; returned as
POSIXctwith time zone support)
Mixing column types in the same table is supported.
field.types argument must be a named character vector with at most
one entry for each column.
It indicates the SQL data type to be used for a new column.
NULL, row names are ignored.
TRUE, row names are converted to a column named "row_names", even if the input data frame only has natural row names from 1 to
NA, a column named "row_names" is created if the data has custom row names, no extra column is created in the case of natural row names.
If a string, this specifies the name of the column in the remote table that contains the row names, even if the input data frame only has natural row names.