diff --git a/lib/connections/snowflake.js b/lib/connections/snowflake.js index de13b0e..d113c84 100644 --- a/lib/connections/snowflake.js +++ b/lib/connections/snowflake.js @@ -152,12 +152,12 @@ connection.prototype.query = function(query, data, callback, skipTransactions){ var runner = self.connection.execute({ sqlText: query, binds: data, - complete: function(err, stmt, rows) { - + complete: function(err, stmt, rows) { if (err) { //In SQL Queries if there are empty lines between sql queries , snowflake throws a exception. This statement provides a workaround to not get that error. - if(String(err.message).includes('Empty SQL statement')) { - callback(null); + if(String(err.message).includes('Empty SQL statement')) { + //fix to avoid callback is already called error- We would want to continue the execution + return callback(null); } else if(!(String(query).startsWith('SHOW COLUMNS') && String(query).endsWith('_TMP'))){ self.book.logger.log('Error in : ' + String(query), 'error'); self.book.logger.log('Error message : ' + err.message, 'error'); @@ -169,8 +169,10 @@ connection.prototype.query = function(query, data, callback, skipTransactions){ self.book.logger.log('Exiting process due to Undefined Query Id ', 'error'); process.exit(1); } - } - callback(err); + } + + callback(err); + } else { if(String(query).includes('INSERT INTO EMPUJAR') ) { self.book.logger.log('Empujar insert , Query Id ' + stmt.getStatementId() + ' Payload Info : ' + String(data), 'debug'); diff --git a/package.json b/package.json index 8a794f7..4faf3d1 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "empujar", - "version": "0.2.23", + "version": "0.2.24", "description": "When you need to push data around, you push it. Push it real good. An ETL and Operations tool.", "main": "index.js", "engines": {