SQL Server R服务:是否计划或正在开发更多输入数据集? [英] SQL Server R Services: Are more input datasets planned or under development?

查看:92
本文介绍了SQL Server R服务:是否计划或正在开发更多输入数据集?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在某些Web应用程序方案中,无法通过ODBC连接收集数据。



通过sp_execute_external_procedure使用R-services的Web应用程序运行Web应用程序服务器。


$
应用程序生成数据 - 假设通过数据导入和一些计算 - 并将数据插入数据库表。下一步应该是在R中处理这些数据。你想通过一个SQL语句
(输入数据集)获得比可能更多的数据。



如果您能够获得ODBC连接(这更多是安全问题)您将找到所需的表已锁定,因为您打开了一个新连接,并且Web应用程序尚未提交或关闭。这是因为Web应用程序处于请求
处理。

In some web application scenarios it is not possible to gather data through ODBC connection.

A web application that uses R-services through sp_execute_external_procedure runs on an web application server.

The application generates the data - let's say through data import and some calculations - and inserts the data into the database tables. Next step should be the processing of this data in R. You want to get more data than possible through only one SQL statement (input dataset).

If You are able to get an ODBC connect (this is more a question of security) You will find the needed tables locked because You open a new connection and the web application's one isn't committed or closed yet. This is because the web application is in a request processing.

A ssuming input_data_2, input_data_3,...
: 是否计划或正在开发更多输入数据集?

Assuming input_data_2, input_data_3, ... :  Are more input datasets planned or under development?

是否有理由将数字限制为1?

Are there reasons to restrict the number to 1?

问候,

Joachim

推荐答案

嗨Joachim,

Hi Joachim,

我不知道是否有更多输入计划数据集,但是,存在"解决方法"。如果您不想从R脚本打开到SQL Server的连接。

I do not know about if more input data sets are planned, however, there is a "workaround" if you do not want to open a connection from your R script back into SQL Server.

您可以做的是从包装程序调用sp_execute_external_script并将数据作为@传入input_data_1,您使用R的序列化功能将数据集序列化为字符串,并将其作为输出参数传回。然后你再次作为
再次调用sp_execute_external_script并传入序列化数据集作为参数。

What you can do is to, from a wrapper procedure, call sp_execute_external_script and pass in the data as @input_data_1, you use R's serialization functionality to serialize the data set to a string, and pass it back out as an output parameter. You then as last step call sp_execute_external_script again and pass in the serialized datasets as parameters.

这里有一个例子:  https://stackoverflow.com/ questions / 42918990 / how-to-pass-two-sql-tables-as-input-parameter-for-r-codes-in-sql-server。

There is an example of it here: https://stackoverflow.com/questions/42918990/how-to-pass-two-sql-tables-as-input-parameter-for-r-codes-in-sql-server.

Niels

 

 


这篇关于SQL Server R服务:是否计划或正在开发更多输入数据集?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆