简体   繁体   中英

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. 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.

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:

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?

您可以使用相同的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.

These are provided for free under GPL. Originally it was only available via Revolution for a fee, but that changed over 1 year ago.

You must register with IBM Developerworks (www.ibm.com/developerworks).

Once registered you can download the software and installation directions.

See 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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