community
cancel
Showing results for 
Search instead for 
Did you mean: 

alteryx server Discussions

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

'WriteYXDBStreaming' Error using R node

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!

Magnetar

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)

 

 

 

 

Asteroid

Hi John,

 

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

Magnetar

 

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.

 

Asteroid

That worked! Thank you! 

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

 

Thanks for the help

Meteoroid

Works for me!! Thank you!!!!

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 

 

Atom

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