Node JS connection with Snowflake

Connecting Node JS with Snowflake

Authored by Ameex Technologies on 27 May 2020

Node js connection with Snowflake could come in handy while moving data between systems where direct connections are not available and an intermediary is required. Node.js is a run-time environment that includes everything required to execute a program written in JavaScript. It is used for running scripts on the server to render content before it is delivered to a web browser. NPM stands for Node Package Manager, which is an application and repository for developing and sharing JavaScript codes.

Let’s get started! For this connection, you’ll require to have access to a Snowflake data warehouse. If you don’t, you can sign up for a free trial account. Written in pure JavaScript, the Node.js driver provides a native asynchronous Node.js interface to Snowflake.The typical workflow for using the driver is:

  • Establish a connection with Snowflake
  • Execute statements, e.g. queries and DDL/DML commands
  • Consume the results
  • Terminate the connection

Refer to the following steps to establish the connection:

Step 1: Install Node.js 

Node.js must already be installed in the environment where you require installing the driver. You can verify this after the installation, by checking the version using the following command:

Click here to know more about installation.

Node JS Connection with Snowflake

Step 2: Install the Snowflake-sdk

After Node installation, you can now use the Node Package Manager (npm) to download and install the snowflake driver. The command downloads and installs the Snowflake Node.js driver.

Node JS Connection with Snowflake

Step 3:

If things have been successful thus far, we are now ready to connect to the Snowflake cloud data warehouse instance via Node.js. Create a directory with the following commands:

Node JS Connection with Snowflake

Step 4:

In this directory, create a file (app.js) by copy- pasting the following text. Remember to use your credentials for account, username, password, and region.

Node JS Connection with Snowflake

Step 5:

Open the terminal window and run the file(app.js) with the following command to create the connection:

Node JS Connection with Snowflake

The node js Snowflake connection is successfully created.

To know more about our cloud expertise, write to us at