getInputParameters: SQL 저장 프로시저의 입력 매개 변수 목록을 가져옵니다.

getInputParameters: 저장 프로시저와 연결된 입력 매개 변수를 설명하는 SQL Server 매개 변수 개체 목록을 반환합니다.

사용

  getInputParameters(sqlSP)

인수

sqlSP

유효한 StoredProcedure 개체

제공된 StoredProcedure 개체와 연결된 SQL Server 매개 변수 개체(InputData, InputParameter)의 명명된 목록입니다. 이름은 개체와 연결된 StoredProcedure에 제공된 R 함수의 변수 이름입니다.


 ## Not run:

 # See ?StoredProcedure for creating the `cleandata` table.
 # and ?executeStoredProcedure for creating the `rdata` table.

 # score1 makes a batch prediction given clean data(indata),
 # model object(model_param), and the new name of the variable
 # that is being predicted
 score1 <- function(indata, model_param, predVarName) {
   indata[,"DayOfWeek"] <- factor(indata[,"DayOfWeek"], levels=c("Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"))
   # The connection string
   conStr <- paste("Driver={ODBC Driver 13 for SQL Server};Server=.;Database=RevoTestDB;",
                   "Trusted_Connection=Yes;", sep = "")
   # The compute context
   computeContext <- RxInSqlServer(numTasks=4, connectionString=conStr)
   mm <- rxReadObject(as.raw(model_param))
   # Predict
   result <- rxPredict(modelObject = mm,
                       data = indata,
                       outData = NULL,
                       predVarNames = predVarName,
                       extraVarsToWrite = c("ArrDelay"),
                       writeModelVars = TRUE,
                       overwrite = TRUE)
 }
 # connections string
 conStr <- paste0("Driver={ODBC Driver 13 for SQL Server};Server=.;Database=RevoTestDB;",
                  "Trusted_Connection=Yes;")
 # create InpuData Object for an input parameter that is a data frame
 id <- InputData(name = "indata", defaultQuery = "SELECT * from cleanData")
 # InputParameter for the model_param input variable
 model <- InputParameter("model_param", "raw",
                         defaultQuery =
                           "select top 1 value from rdata where [key] = 'linmod.v1'")
 # InputParameter for the predVarName variable
 name <- InputParameter("predVarName", "character")
 sp_df_df <- StoredProcedure(score1, "sTest", id, model, name,
                         filePath = ".")

 # inspect the input parameters
 getInputParameters(sp_df_df)  # "model_param" "predVarName" "indata"

 # register the stored procedure with a database
 registerStoredProcedure(sp_df_df, conStr)
 # assign a different query to the InputData so that it only uses the firt 10 rows
 id <- setInputDataQuery(id, "SELECT top 10 * from cleanData")
 # assign a value to the name parameter
 name <- setInputParameterValue(name, "ArrDelayEstimate")
 # execute the stored procedure
 model <- executeStoredProcedure(sp_df_df, id, name, connectionString = conStr)
 model$data
## End(Not run)