Alert: There is a planned Community maintenance outage October 16th from approximately 10 - 11 PM PST. During this time the Alteryx Community will be inaccessible. Thank you for your understanding!

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
SOLVED

Writing SQL Query in R tool

oonwuka
5 - Atom

I am trying to run a sql query in the R tool.

But i get this error:

Info: R (6):   no such table: XXXXXXXXX

 

My code in the R tool is:

library(sqldf)

the.data <- read.Alteryx("#1", mode="data.frame")

the.data1 <- sqldf("Select * From RMS.RMS_DXH_LATRON_DATA" )

write.Alteryx(the.data1, 1)

 

How do i execute sql queries in the R tool?

2 REPLIES 2
PaulN
Alteryx Alumni (Retired)

Hi @oonwuka,

 

Thanks for posting this question!

 

Honestly, I am not sure of the benefits of using sqldf inside R tool instead of Alteryx tools (select, filter, join, etc.)... but please find an example below:

 


sqldf.png

 

In your code, you don't seem to connect sqldf query to the data loaded in the R tool (RMS.RMS_DXH_LATRON_DATA is not defined).

 

Thanks,

 

Paul Noirel

Sr Customer Support, Alteryx

oonwuka
5 - Atom

It works...thanks

 

I needed to prove to our scientist that their native R scripts can be run (with as little modification as possible) in the R-tool

Labels