db.write_table: Write data frames to remote database tables with additional...

View source: R/sqlite_db.R

db.write_tableR Documentation

Write data frames to remote database tables with additional validation

Description

Wrapper function to write data to table in default or custom schema. Returns TRUE if successful, FALSE otherwise.

Usage

db.write_table(
  con,
  data,
  table,
  schema = NA,
  append_only = FALSE,
  drop_overwrite = NA
)

Arguments

con

An object that inherits from DBIConnection-class, typically generated by dbConnect()

data

A data.frame, tbl, or other valid SQL data type containing the data to write to the database.

table

A character string specifying the DBMS table name.

schema

A character string specifying the schema in which the table is nested.

append_only

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.

drop_overwrite

A logical specifying whether the operation is DROP and INSERT. This will overwrite any existing field types.

Value

Returns TRUE if the SQL query executes successfully, FALSE otherwise.

Examples

connection <- connect_sqlite(auto_disconnect = FALSE)

db.write_table(con = connection, table = 'iris', data = iris)


danielkovtun/shinyNotes documentation built on Feb. 22, 2023, 3:11 p.m.