saveDF: Save Save a dataframe to a database, storing it in decomposed...

Description Usage Arguments See Also Examples

View source: R/sql.R

Description

Save Save a dataframe to a database, storing it in decomposed form:

Usage

1
saveDF(con, df, name, overwrite = TRUE, ...)

Arguments

con

An SQL database connection (generated via DBI::dbConnect()).

df

The dataframe to save.

name

The table name to use in the database.

overwrite

Should the dataframe overwrite the existing content under that table name?

...

Additional arguments to pass to the database write call for the dataframe.

See Also

Pure functions to decompose/recompose dataframes: decomposeDF() recomposeDF()

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
con <- DBI::dbConnect(RSQLite::SQLite(), ":memory:")

df <- tibble::tibble(
  a = factor(c("a", "a", "b"), levels = c("a", "b"), ordered = TRUE),
  b = c(TRUE, TRUE, FALSE),
  c = c(1,2,3)
 )

saveDF(con, df, "test_1")

loadDF(con, "test_1")

DBI::dbDisconnect(con)

eccc-cdo/SQLTypeR documentation built on March 23, 2020, 5:25 a.m.