4.5.0 • Published 3 years ago
snowflake-promise v4.5.0
snowflake-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-promise
Basic usage
const Snowflake = require('snowflake-promise').Snowflake;
// or, for TypeScript:
import { Snowflake } from 'snowflake-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'
});
await snowflake.connect();
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 ] ])
connectionOptions
- Supported options are here: https://docs.snowflake.net/manuals/user-guide/nodejs-driver-use.html#required-connection-options
loggingOptions
logSql
(optional, function): If provided, this function will be called to log SQL statements. For example, setlogSql
toconsole.log
to log all issued SQL statements to the console.logLevel
(optional:'error' | 'warn' | 'debug' | 'info' | 'trace'
): Turns on SDK-level logging.
configureOptions
ocspFailOpen
(optional, boolean) (default:true
): Enables OCSP fail-open functionality. See https://www.snowflake.com/blog/latest-changes-to-how-snowflake-handles-ocsp/ for more information.
More examples
- Streaming result rows
- Using traditional Promise
then
syntax (and older versions of Node.js)- Node v6.9.5 is the oldest supported version
- Turn on logging
4.5.0
3 years ago
4.4.0
3 years ago
4.2.0
4 years ago
4.1.0
4 years ago
4.0.0
4 years ago
2.2.0
4 years ago
2.0.1
5 years ago
2.0.0
5 years ago
1.11.0
5 years ago
1.10.0
5 years ago
1.9.0
5 years ago
1.8.0
5 years ago
1.7.0
6 years ago
1.6.0
6 years ago
1.5.0
6 years ago
1.4.1
7 years ago
1.4.0
7 years ago
1.3.0
7 years ago
1.2.1
7 years ago
1.2.0
7 years ago
1.1.0
7 years ago
1.0.0
7 years ago