I have a notebook that queries our Snowflake instance. Oddly, the first time I run the SQL chunk it fails with an error, “Failed to create SQL chunk directory”. If I immediately run the chunk again, it will run the query without issue.
Why does this happen?
library(dbplyr)
library(DBI)
db_connection <- DBI::dbConnect(odbc::odbc(),
<connection parameters>
)
The above connection chunk runs fine, first time, every time. This next chunk is the weirdo:
{sql, connection=db_connection, output.var = "clozd_candidates"}
SELECT <a bunch of SFDC fields from Snowflake tables>
FROM <tables>
WHERE <clauses>
GROUP BY <same fields I selected above>
This chunk runs the second time I invoke it, and everytime thereafter for as long as the connection is good. If I have to reinstate the connection, then I get the error on the first run of the chunk.
What the heck?
I thought I could set this query up in an R Notebook and run the chunks as the full chain, but apparently I have to run them one by one, due to the error. (Failed to create SQL chunk directory). Once I’ve run this chunk the first time, then I’m good.
I was expecting it to run everytime, of course.
Thoughts?
Matthew Coblentz is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.