Description Usage Arguments Details Value Examples
View source: R/saveSQLDataFrame.R
The function to save SQLDataFrame
object as a
database table with a supplied path to database. It also
returns a SQLDataFrame
object constructed from the
user-supplied dbname
, dbtable
, and dbkey
.
1 2 3 4 5 6 7 8 9 | saveSQLDataFrame(
x,
dbname = tempfile(fileext = ".db"),
dbtable = deparse(substitute(x)),
localConn = connSQLDataFrame(x),
overwrite = FALSE,
index = TRUE,
...
)
|
x |
The |
dbname |
A character string of the file path of to be saved SQLite database file. Will only be used when the input SQLDataFrame represents a SQLite database table. Default to save in a temporary file. |
dbtable |
A character string for the to be saved database
table name. Default is the name of the input
|
localConn |
A MySQL connection with write permission. Will be used only when the input SQLDataFrame objects connects to MySQL connections without write permission. A new MySQL table will be written in the the database this argument provides. |
overwrite |
Whether to overwrite the |
index |
Whether to create the database index. Default is TRUE. |
... |
other parameters passed to methods. |
For SQLDataFrame from union
or rbind
, if
representation of MySQL tables, the data will be sorted by key
columns, and saved as MySQL table in the connection with write
permission.
A SQLDataFrame
object.
1 2 3 4 5 6 7 | test.db <- system.file("extdata/test.db", package = "SQLDataFrame")
conn <- DBI::dbConnect(DBI::dbDriver("SQLite"), dbname = test.db)
obj <- SQLDataFrame(conn = conn, dbtable = "state", dbkey = "state")
obj1 <- obj[1:10, 2:3]
obj1 <- saveSQLDataFrame(obj1, dbtable = "obj_subset")
connSQLDataFrame(obj1)
dbtable(obj1)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.