I have been trying to run a simple Snowflake query using Node. Everything connects and seems ok but I can't seem to hook the Results of the query. The code below is based on the official docs here This correctly logs the number of rows but can't log the actual results. Unless i'm missing something the Docs don't show any object information.
Any ideas folks?
var snowflake = require('snowflake-sdk');
var connection = snowflake.createConnection( {
account: 'xxx',
username: 'xxx',
password: 'xxx',
database: 'xxx',
warehouse: 'xxx',
role: 'xxx'
} );
connection.connect(
function(err, conn) {
if (err) {
console.error('Unable to connect: ' + err.message);
}
else {
console.log('Successfully connected to Snowflake.');
connection_ID = conn.getId();
var statement = connection.execute({
sqlText: 'SELECT * FROM MY_SCHEMA.MY_TABLE LIMIT 1;',
complete: function(err, stmt, rows) {
if (err) {
console.error('Failed to execute statement due to the following error: ' + err.message);
} else {
console.log('Successfully executed statement: ' + stmt.getSqlText() + ' > ' + rows.length);
}
}
});