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!
Solved! Go to Solution.
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)
Hi John,
Unfortunately I have already tried that, and it did not work.
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.
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
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
That worked for me as well, thank you for sharing!
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:
Using the lapply as.character trick outlined, I am still getting the following error:
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