Free Trial

Alteryx Server Discussions

Find answers, ask questions, and share expertise about Alteryx Server.
SOLVED

'WriteYXDBStreaming' Error using R node

ckestler
8 - Asteroid

Has anyone ever seen this error before when trying to query to a database using an R node? 

 

My code runs in R, but not in Alteryx..and I get this 'WriteYXDBStreaming Error.

 

Also, my first call to the DB works, but not the rest. (first is: s_o <- sqlQuery(mxctl,s_o_query) ...see bottom of R code)

 

When I check the data types of the output, they are all of class data.frame.

 

I have attached my workflow. Thanks in advance!

12 REPLIES 12
JohnJPS
15 - Aurora

Hi @ckestler

Something to try... towards the end of your R script, you have a few instances of, basically, this:

 

queryOutput <- sqlQuery(mxctl, queryText)

write.alteryx(queryOutput, 1)

 

Try castin your datasets to data frames prior to wrting them to Alteryx output... so you could do:

 

queryOutput <- as.data.frame(sqlQuery(mxctl, queryText))

write.Alteryx(queryOutput, 1)

 (or, equivalently)

 queryOutput <- sqlQuery(mxctl, queryText)

write.alteryx(as.data.frame(queryOutput), 1)

 

 

 

 

ckestler
8 - Asteroid

Hi John,

 

Unfortunately I have already tried that, and it did not work. 

JohnJPS
15 - Aurora

 

Other thougths include data embedded in the data table that doesn't write out nicely as character data; or simply a really large data frame that wants to be chunked...

 

Forcing to character data... you could try this prior to Write.Alteryx, where df is your data frame...

 

df[] <- lapply(df, as.character)

That way you should have a data frame that's all character data.

 

 

If it continues to fail, you could even try to write.csv manually from within tyour script, then using a Block Until Done tool, read in that output after the R tool has completed.  Hopefully it doesn't come to that, but it's something you could try.

 

ckestler
8 - Asteroid

That worked! Thank you! 

mtpesavento
5 - Atom

This suggestion worked for me too, with the only trivial difference being my use case called for as.numeric

 

Thanks for the help

RZhong
6 - Meteoroid

Works for me!! Thank you!!!!

nav_sri_in
5 - Atom

HI There

I was also facing the same issue and tried lot of thing but only lapply worked well.

Thank for your advice.

Regards 

Naveen 

 

kmoreno
6 - Meteoroid

That worked for me as well, thank you for sharing!

ries9112
7 - Meteor

What was outlined by JohnJPS seems to work for most people, but that did not do the trick for me.

 

This is what my code looks like to write the data to Alteryx:

ries9112_2-1574189574245.png

 

Using the lapply as.character trick outlined, I am still getting the following error:

ries9112_4-1574189693416.png

You can tell there is data coming through from the resulting output of print(head(prediction)) shown in the screenshot above.

 

I'd be curious to hear anyone's thoughts as to why this didn't work for me and what is going on here,

Ricky