Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- save_data <- function(data) {
- # Connect to the database
- db <- dbConnect(MySQL(), dbname = databaseName, host =
- options()$mysql$host,
- port = options()$mysql$port, user = options()$mysql$user,
- password = options()$mysql$password)
- # Add insertion time stamp of the record and re-order columns
- data <- data %>%
- mutate(insert_dtm = Sys.time()) %>%
- select (insert_dtm, everything()) %>%
- # Construct the update query by looping over the data fields
- query <- sprintf(foo)
- # Submit the update query and disconnect
- dbGetQuery(db, query)
- dbDisconnect(db)
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement