Creating Snowflakes SDK wrapper for NodeJS API
Snowflake provides the best warehouse cloud solution. Snowflake is a data warehouse built on top of the Amazon Web Services or Microsoft Azure cloud infrastructure. To connect Snowflake in NodeJS required snowflake-SDK.
The snowflake SDK lacks documentation. So in this article, we will discuss how to create a wrapper to execute snowflake SQL statements. The first step is to install the snowflake. Check below npm install.
npm i snowflake-sdk
After the snowflake is installed, create types for snowflakes.
npm i -D @types/node @types/snowflake-sdk
Now once the snowflake is installed, we are good to import it.
import * as snowflake from ‘snowflake-sdk’;
Once the import is done, the first step is to create a connection.
Creating SnowFlake Connection
The first step is to create a snowflake connection. To initialize the environment, create a initialize environment.
const initializeEnvironment = {account: ‘xxxxxxxxxxx.us-east-1’,username: ‘SNOWFLAKE_DEV_BATCH_USER’,password: ‘password’,role:’DB_DEVELOPER_ROLE’,