R/sqlite_db.R
db.write_table.Rd
Wrapper function to write data to table in default or custom
schema. Returns TRUE
if successful, FALSE
otherwise.
db.write_table(
con,
data,
table,
schema = NA,
append_only = FALSE,
drop_overwrite = NA
)
An object that inherits from
DBIConnection-class
, typically generated by
dbConnect()
A data.frame
, tbl
, or other valid SQL data type
containing the data to write to the database.
A character string specifying the DBMS table name.
A character string specifying the schema in which the table is nested.
A logical specifying whether the operation is
INSERT
or UPDATE
. Default of append_only = FALSE
means
execute DELETE
on table, and update with new data.
A logical specifying whether the operation is
DROP
and INSERT
. This will overwrite any existing field
types.
Returns TRUE
if the SQL query executes successfully,
FALSE
otherwise.
connection <- connect_sqlite(auto_disconnect = FALSE)
db.write_table(con = connection, table = 'iris', data = iris)
#> Table iris successfully updated 2023-02-19 08:57:32
#> [1] TRUE