ROLLBACK - Unable to perform operation using terminated connection

I've tried everything I can think of and I still get intermittent errors in my workflow of "Error evaluating query5: ROLLBACK - Unable to perform operation using terminated connection."

I've created a brand new resource and user to my Snowflake Database so this is the ONLY thing that is running. Regardless of if I have 2 queries or 1 in the workflow that use this user I am still getting the error. I know it's not a timeout issue because the entire workflow (with the error) is only taking 10 seconds to complete. The first query using the resource runs without fail, but the second query fails regularly.

Any help would be appreciated! Will try to jump into the next office hours as well.

Thank you for coming to office hours, Kirk! Posting our conversation so we can continue it here:

My teammate wrote this JS snippet (to use in a JS Query) up for another user running into the same issue trying to run a bulk insert statement with an array column in Snowflake:

const jsonData = mergeAPI.data

let values = "";

jsonData.forEach(row => {

  let rowValues = "";

  Object.keys(row).forEach(key => {
    let value = row[key];

    if (typeof value === 'number') {
      value = value; // no quotes 
    } else if (typeof value === 'string') {
      value = `'${value}'`; // single quotes
    } else if (value instanceof Date) {
      value = value.toISOString().slice(0,10); // date format
    } else {
      value = JSON.stringify(value); // other types
    }

    rowValues += value + ",";

  });

  rowValues = rowValues.slice(0,-1); // remove trailing comma

  values += `(${rowValues}),\n`;

});

values = values.slice(0, -2); 

const columns = Object.keys(jsonData[0]).join(",");

const query = `INSERT INTO merge.balance_sheets (${columns}) VALUES ${values}`;


return query

where merge.balance_sheets is the table name

And then you ran into this error:

{"data":null,"error":{"error":true,"message":"SQL compilation error:\nsyntax error line 1 at position 79 unexpected '\"attempt_hourly_limit\"'...}}}

As a note, the above JS will require disabling prepared statements on your resource. If you’re security conscious, you may want to create a separate, identical resource for this, and lock the permissions down the permissions, with the disabled prepared statements ticked.

Let me know if that’ll work for you for the time being until we fix this bulk insert bug!