简体   繁体   English

R中的Passthrough查询

[英]Passthrough query in R

In SAS I'm used to PROC SQL, that I can use to query the database and return data into SAS, or execute SQL code in database. 在SAS中,我习惯于使用PROC SQL,我可以使用它来查询数据库并将数据返回到SAS,或者在数据库中执行SQL代码。 For example, from SAS I can use PROC SQL to run a passthrough query to create a new table on my database from another table on the database. 例如,从SAS我可以使用PROC SQL运行直通查询,从数据库上的另一个表创建我的数据库上的新表。

proc sql;
connect to netezza ( SERVER=X DATABASE=Z  AUTHDOMAIN="Y");
execute
(
create table B as
select * from A

)
by netezza
;
quit;

In R I'm able to connect and query a database using RODBC and some code like: 在R中,我能够使用RODBC和一些代码连接和查询数据库,例如:

connect1 <- odbcConnect("NZ",believeNRows=FALSE) 

query1 <- "SELECT * FROM A"

df_imp <- sqlQuery(connect1, query1)

But how do I go about doing something similar to the SAS code above? 但是,如何进行与上述SAS代码类似的操作呢?

您可以使用相同的sqlQuery

sqlQuery(connect1, "CREATE TABLE b as SELECT * FROM a")

IBM provides several interfaces to use R with Netezza, to include running R within the appliance. IBM提供了几个将R与Netezza一起使用的接口,以包括在设备中运行R.

These are provided for free under GPL. 这些是在GPL下免费提供的。 Originally it was only available via Revolution for a fee, but that changed over 1 year ago. 最初只有革命才能收取费用,但这种情况在1年前发生了变化。

You must register with IBM Developerworks (www.ibm.com/developerworks). 您必须在IBM Developerworks(www.ibm.com/developerworks)上注册。

Once registered you can download the software and installation directions. 注册后,您可以下载软件和安装说明。

See http://ibm.co/XOC1q3 http://ibm.co/XOC1q3

On this wiki (under the How To section), there are several documents and labs regarding the use of R with Netezza. 在这个wiki上(在How To部分下),有几个关于R与Netezza一起使用的文档和实验。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM