This is a legacy R code that is running for months. I was able to read/drop a table in Teradata from R but not able to write data into the table from data frame.
I have tried by dropping table and recreating and writing different dataframe.
sqlSave(ch, df, tablename = paste("scenario.table_storetype"),rownames=F)
I was getting the following error
Error in sqlColumns(channel, tablename)[4L][, 1L]: incorrect number of dimensions Traceback:
1. sqlSave(ch, df, tablename = paste("scenario.table_storetype"), . rownames = F, safer = FALSE, append = T)
2. sqlwrite(channel, tablename, dat, verbose = verbose, fast = fast, . test = test, nastring = nastring)
dput(head(df))
Output: structure(list(forecast = c(36659805.75, 28117111.75, 27005618.75, 33650734.4166667, 27243750.75, 26907919.0833333), actual = c(38293943, 29892143, 27016674, 33524728, 27252399, 26521098), BC = c("Prepared Salad, Fruit & Veg", "Prepared Salad, Fruit & Veg", "Prepared Salad, Fruit & Veg", "Prepared Salad, Fruit & Veg", "Prepared Salad, Fruit & Veg", "Prepared Salad, Fruit & Veg"), period = 201904:201909, how = c("a_tslm_mape", "a_tslm_mape", "a_tslm_mape", "a_tslm_mape", "a_tslm_mape", "a_tslm_mape" )), .Names = c("forecast", "actual", "BC", "period", "how"), row.names = c(NA, 6L), class = "data.frame")
dput(head(df))
After rounding off - Output: structure(list(forecast = c(36659805.75, 28117111.75, 27005618.75, 33650734.42, 27243750.75, 26907919.08), actual = c(38293943, 29892143, 27016674, 33524728, 27252399, 26521098), BC = c("Prepared Salad, Fruit & Veg", "Prepared Salad, Fruit & Veg", "Prepared Salad, Fruit & Veg", "Prepared Salad, Fruit & Veg", "Prepared Salad, Fruit & Veg", "Prepared Salad, Fruit & Veg"), period = 201904:201909, how = c("a_tslm_mape", "a_tslm_mape", "a_tslm_mape", "a_tslm_mape", "a_tslm_mape", "a_tslm_mape" )), .Names = c("forecast", "actual", "BC", "period", "how"), row.names = c(NA, 6L), class = "data.frame")
dim(df)
? Try reducing rows and test. ODBC driver might be imposing limits. - ParfaitsqlSave(ch, head(df, 10), tablename = paste("scenario.table_storetype"),rownames=F)
. Your issue may be a size restriction. - Parfaitdput(head(df))
so we can see its properties/dimensions. - Parfait