Skip to content

Node.js Promise-based interface for accessing Snowflake databases

License

Notifications You must be signed in to change notification settings

natesilva/snowflake-promise

Repository files navigation

snowflake-promise npm node

A modern, Promise-based interface for the Snowflake Node.js SDK with full TypeScript support.


v5 Beta Now Available!

Version 5 is a complete rewrite with improved TypeScript support while maintaining full backwards compatibility.

📚 Full Documentation for v5 beta

📦 Install v5 beta: npm i snowflake-promise@beta

v5 Features

  • Clean Promise-based API
  • Full TypeScript support
  • Backwards compatible with the previous version of this library
  • Legacy callback API compatibility
  • Modern ESM/CJS dual package support
  • 100% test coverage

The documentation below covers version 4, the current stable version of the library.

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 ] ])

More examples

About

Node.js Promise-based interface for accessing Snowflake databases

Resources

License

Stars

Watchers

Forks

Packages

No packages published