snowflake-sdk-promise

A Promise-based interface to your Snowflake data warehouse.
This is a wrapper for the Snowflake SDK for Node.js. It provides a Promise-based API instead of the core callback-based API.
Installation
npm i snowflake-sdk-promise
Basic usage
import { Snowflake } from 'snowflake-sdk-promise';
async function main() {
const snowflake = new Snowflake({
account: '<account name>',
username: '<username>',
password: '<password>',
database: 'SNOWFLAKE_SAMPLE_DATA',
schema: 'TPCH_SF1',
warehouse: 'DEMO_WH'
});
const rows = await snowflake.execute(
'SELECT COUNT(*) FROM CUSTOMER WHERE C_MKTSEGMENT=:1',
['AUTOMOBILE']
);
console.log(rows);
}
main();
Connecting
The constructor takes up to three arguments:
new Snowflake(connectionOptions, [ loggingOptions, [ configureOptions ] ])
OR
new SnowflakePool(connectionOptions, [ loggingOptions, [ configureOptions ] ])
connectionOptions
loggingOptions
logSql
(optional, function): If provided, this function will be called to log SQL
statements. For example, set logSql
to console.log
to log all issued SQL
statements to the console.
logLevel
(optional: "ERROR" | "WARN" | "DEBUG" | "INFO" | "TRACE"
): Turns on
SDK-level logging.
configureOptions
More examples
Credits
This project has started as a fork of snowflake-promise