Does anyone has a working code to connect NodeJS and Snowflake.
Tried following instructions for NodeJS:
var snowflake = require('snowflake-sdk');
var connection = snowflake.createConnection({
account: 'account1',
username: 'user1',
password: 'pass1',
region: 'us-east-1'
});
connection.connect(function(err, conn) {
if (err) {
console.error('Unable to connect: ' + err.message);
} else {
console.log('Successfully connected as id: ' + connection.getId());
}
});
Keep getting errors:
Network error. Could not reach Snowflake.
Similarly - following instructions for Python works without problem (using EXACT same user/pass/account etc. as for NodeJS):
import snowflake.connector
ctx = snowflake.connector.connect(
user='user1',
password='pass1',
account='account1'
)
print ("SELECT current_version():")
cs = ctx.cursor()
try:
cs.execute("SELECT current_version()")
one = cs.fetchone()
print(one[0]) # 2.50.2
finally:
cs.close()
The account that use in python has "account_id.region" something like
ctx = snowflake.connector.connect(
user='user1',
password='pass1',
account='abc.us-east-1'
)
For node.js you need to give the same as:
var connection = snowflake.createConnection({
account: 'abc',
username: 'user1',
password: 'pass1',
region: 'us-east-1'
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With