1

I'm trying to call the Standard R code via the function "rxExec" to execute the code remote.

My compute context is RxInSqlServer() and the connection to the server is fine.

Is this call possible in general? Or is there a better way to perform Standard R remote via SQL R Server Services?

function1 <- function(varIn,varOut) {
  df<- rxImport(varIn)
  df<- ... [STANDARD R CODE]
  rxDataStep(inData = df,
             outFile = varOut
             numRows=1000)
}

rxSetComputeContext(cc)

sql <- "SELECT * FROM ..."
dbIn <- RxSqlServerData(sqlQuery = sql,
                                connectionString = conn)
dbOut <- RxSqlServerData(table = "nameTable",
                           connectionString = conn)

rxExec(function1, varIn = dbIn, varOut = dbOut) 

With a similar example, but without writting the Data-Output i a table only with a return value I get the same error

function1 <- function(varIn) {
  df<- rxImport(varIn)
  df<- ... [STANDARD R CODE]
  return(data)
}

rxSetComputeContext(cc)

sql <- "SELECT * FROM ..."
dbIn <- RxSqlServerData(sqlQuery = sql,
                                connectionString = conn)

x<- rxExec(function1, varIn = dbIn) 

Error message: Warning: namespace 'CompatibilityAPI' is not available and has been replaced by .GlobalEnv when processing object 'inputObject'

Error in slot(from, what) : no slot of name "maxColWidth" for this object of class "RxSqlServerData" Calls: source ... anyStrings -> validityMethod -> as -> asMethod -> slot Execution halted

Error in rxCompleteClusterJob(hpcServerJob, consoleOutput, autoCleanup) : No results available - final job state: failed

Thanks!

user43348044
  • 305
  • 3
  • 15
  • The error message is occuring because you seem to have different versions of MRS installed on your client and remote machine. Could you please provide the version info for MRS on the client as well as the MRS version in your SQL Server instance? – Kirill Glushko - Microsoft May 05 '17 at 17:42
  • I would never come of the version through this error message. You mean the version of Microsoft R Open (3.3.3) or the version of the R Server (e.g. 9.1)? Isnthe usage of rxExec the right way to perform standard R on SQL Server Services? – user43348044 May 07 '17 at 16:08
  • Yes, rxExec() is one correct way to perform standard R code in SQL Server R Services. This issue, I believe, is that the SQL Server version is a lower version than your Client. If your client R server is MRO 3.3.3 with R Server 9.1, could you please ensure that your R Services in SQL Server is the same version? – Kirill Glushko - Microsoft May 08 '17 at 17:53
  • The version of the server is 8 and the cersion of my client 9, so this is probably the problem. But I think it isn't so easy to upgrade the server version, right? – user43348044 May 09 '17 at 12:34
  • That is the reason you're getting this error, Microsoft R Server 9.1 is only compatible with Microsoft R Server 9.0 and higher. Upgrading the server is relatively easy, just download the latest SQL Server installer from MSDN and use it to Upgrade Microsoft R and R Services on the Server. You can find a detailed guide here: https://learn.microsoft.com/en-us/sql/advanced-analytics/r/set-up-sql-server-r-services-in-database – Kirill Glushko - Microsoft May 09 '17 at 17:41

0 Answers0