insertTable: Insert a table on the server

Description Usage Arguments Details Examples

Description

This function sends the data in a data frame or ffdf to a table on the server. Either a new table is created, or the data is appended to an existing table.

Usage

1
2
insertTable(connection, tableName, data, dropTableIfExists = TRUE,
  createTable = TRUE, tempTable = FALSE, oracleTempSchema = NULL)

Arguments

connection

The connection to the database server.

tableName

The name of the table where the data should be inserted.

data

The data frame or ffdf containing the data to be inserted.

dropTableIfExists

Drop the table if the table already exists before writing?

createTable

Create a new table? If false, will append to existing table.

tempTable

Should the table created as a temp table?

oracleTempSchema

Specifically for Oracle, a schema with write priviliges where temp tables can be created.

Details

This function sends the data in a data frame to a table on the server. Either a new table is created, or the data is appended to an existing table.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
## Not run: 
connectionDetails <- createConnectionDetails(dbms = "mysql",
                                             server = "localhost",
                                             user = "root",
                                             password = "blah",
                                             schema = "cdm_v4")
conn <- connect(connectionDetails)
data <- data.frame(x = c(1, 2, 3), y = c("a", "b", "c"))
insertTable(conn, "my_table", data)
dbDisconnect(conn)

## End(Not run)

fagirtmi/DatabaseConnector documentation built on May 16, 2019, 9:58 a.m.