I'm writing a query using RPostgreSQL
meant to fill a table one time. I really have no intention to do anything else with the data within R. I just need it for is to run the function to fill that table.
library(data.table)
library (RPostgreSQL)
MakeAndGetQuery <- function(id) {
q <- paste0("INSERT INTO table_a SELECT * FROM table_c WHERE client_id = ",
id,
" AND event_date = CURRENT_DATE - 1")
as.data.table(dbGetQuery(conn2, q))
}
all_yer_data <- rbindlist(lapply(generate_id$client_id, MakeAndGetQuery))
setkey(all_yer_data, id, ...)
So my question is, will not doing anything with the dataframe within R impact if it runs successfully? In theory, that SQL statement shouldn't even produce any results within R. It's using INSERT INTO
from Redshift, so if I ran that in Redshift, it wouldn't return any results, just a message saying it was successfull and "5 Rows affected"