I have a R script that fetches results from a SQL query from R studio on windows, but not Rapache on linux. My two connection strings are:
channel = odbcDriverConnect('Driver=FreeTDS;Server=server\\instance;Database=DB;Uid=name;Pwd=password')
channel = odbcDriverConnect('Driver={SQL Server};Server=name\\instance;Database=DB;Trusted_Connection=True;')
I construct some SQL and pass it to this function:
get_sql_data <- function(query,as.is=TRUE){
return(sqlQuery(channel, query,as.is=as.is, errors=TRUE))
}
I look in SQL profile and see a BatchStarting and BatchCompleted event for the query from Rapache. I copy and past the Query into SSDT and get rows back. In Rstudio I can View() the resulting dataframe. In rapache I head it like this:
warning('head head')
warning(head(RESULTS))
warning('head tail')
I get the following:
2: In eval(expr, envir, enclos) : head head
3: In eval(expr, envir, enclos) :
4: In eval(expr, envir, enclos) : head tail
What am I doing wrong? Do I need to use sqlGetResults()
or something?