# snowflake-promise

> A Promise-based, TypeScript-friendly helper for the Snowflake SDK

Latest version **5.0.1** (published 2025-08-19) · MIT license · 0 weekly downloads

## Install

```sh
npm install snowflake-promise
pnpm add snowflake-promise
yarn add snowflake-promise
bun add snowflake-promise
```

## Health

**Score 45/100 (D)** — status: stable.

Positive: esm support; no vulnerabilities; high maintenance score.

Warnings: low downloads; no types.

Negative: stale.

## Facts

| | |
|---|---|
| Version | 5.0.1 |
| Published | 2025-08-19 |
| First published | 2017-09-11 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM |
| Node | >=20 |
| Dependencies | 1 |
| Unpacked size | 92 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 39 |
| Author | Nate Silva |
| Maintainers | natesilva |
| Keywords | snowflake, database, data warehouse, warehouse, promise, typescript |

## Links

- npm: https://www.npmjs.com/package/snowflake-promise
- Repository: https://github.com/natesilva/snowflake-promise
- Homepage: https://github.com/natesilva/snowflake-promise#readme
- Issues: https://github.com/natesilva/snowflake-promise/issues
- npm.io page: https://npm.io/package/snowflake-promise

## Dependencies (1)

- [type-fest](https://npm.io/package/type-fest.md) ^4.37.0

## Alternatives

- [@openai/codex-sdk](https://npm.io/package/@openai/codex-sdk.md) — 731.4K weekly downloads
- [babel-plugin-transform-react-jsx](https://npm.io/package/babel-plugin-transform-react-jsx.md) — 565.0K weekly downloads
- [babel-helper-remove-or-void](https://npm.io/package/babel-helper-remove-or-void.md) — 508.5K weekly downloads
- [@pnpm/store-controller-types](https://npm.io/package/@pnpm/store-controller-types.md) — 186.9K weekly downloads
- [react-native-signature-canvas](https://npm.io/package/react-native-signature-canvas.md) — 155.6K weekly downloads

## Recent versions

- 5.0.1 (latest) — 2025-08-19
- 5.0.0-beta.4 (beta) — 2025-08-10
- 5.0.0 — 2025-08-10
- 5.0.0-beta.3 — 2025-08-10
- 5.0.0-beta.2 — 2025-04-12
- 5.0.0-beta.1 — 2025-04-01
- 4.5.0 — 2021-03-12
- 4.4.0 — 2021-03-09
- 4.2.0 — 2020-10-19
- 4.1.0 — 2020-08-26
- 4.0.0 — 2020-08-05
- 2.2.0 — 2019-11-19
- 2.0.1 — 2019-09-23
- 2.0.0 — 2019-09-13
- 1.11.0 — 2019-07-11
- … 12 more at https://npm.io/package/snowflake-promise/versions

## README

# snowflake-promise [![npm](https://img.shields.io/npm/v/snowflake-promise.svg)](https://www.npmjs.com/package/snowflake-promise) [![node](https://img.shields.io/node/v/snowflake-promise.svg)](https://www.npmjs.com/package/snowflake-promise)

A modern, Promise-based interface for the [Snowflake](https://www.snowflake.net/) Node.js SDK with full TypeScript support.

---

## Promise Support for the Snowflake SDK

### Quick Start

- 📦 Install: `npm i snowflake-promise`
- 📚 [Full Documentation](https://natesilva.github.io/snowflake-promise/docs/)

### Why use it?

The [official Snowflake SDK](https://docs.snowflake.com/en/developer-guide/node-js/nodejs-driver) uses a callback-based API, which can be difficult to manage in modern JavaScript applications. It leads to code that’s hard to understand and hard to maintain.

Promises and `async`/`await` are the modern replacement for callbacks. `snowflake-promise` provides a lightweight adapter that adds Promise support to the SDK's callback-based methods, making it easy to work with Snowflake in Node.js.

### Features

- Works with the official Snowflake Node.js SDK
- Adds Promise support to callback-based methods
- Allows you to use async/await for cleaner, more readable code
- Fully backward compatible with existing (callback-based) code that uses the Snowflake SDK
- Supports all authentication methods: username/password, MFA, key pair, OAuth
- Supports all Snowflake SDK features, including streaming large result sets
- Modern ESM/CJS dual package support
- Built with 100% test coverage

## Basic Usage

`snowflake-promise` provides a lightweight adapter for the Snowflake Node.js SDK. Pass a Snowflake SDK `Connection` object to the `promisifyConnection` function, and it will be enhanced with full Promise support.

Here's a simple example of how to use `snowflake-promise` to connect to Snowflake, execute a query, and handle the results:

```typescript
import snowflakeSdk from "snowflake-sdk";
import { promisifyConnection } from "snowflake-promise";

async function main() {
  // Create a connection
  const connection = snowflakeSdk.createConnection({
    account: "<account name>",
    username: "<username>",
    password: "<password>",
    database: "SNOWFLAKE_SAMPLE_DATA",
    schema: "TPCH_SF1",
    warehouse: "DEMO_WH",
  });

  // ✨ Promisify the connection
  const promisifiedConnection = promisifyConnection(connection);

  // Connect (no callbacks -- you can use async/await)
  await promisifiedConnection.connect();

  // Execute a query (no callbacks)
  const { resultsPromise } = promisifiedConnection.execute({
    sqlText: "SELECT COUNT(*) FROM CUSTOMER WHERE C_MKTSEGMENT=:1",
    binds: ["AUTOMOBILE"],
  });

  // Get the results (no callbacks)
  const rows = await resultsPromise;
  console.log(rows);
}

main();
```

See the [Full Documentation](https://natesilva.github.io/snowflake-promise/docs/) for details on:

- [Authentication options (MFA, Key Pair, OAuth, etc.)](https://natesilva.github.io/snowflake-promise/docs/authentication-and-mfa/)
- [Executing queries and handling results](https://natesilva.github.io/snowflake-promise/docs/examples/executing-queries/query-example-1/)
- [Streaming results](https://natesilva.github.io/snowflake-promise/docs/examples/executing-queries/query-example-2/)
- [Backward compatibility and migration from previous versions](https://natesilva.github.io/snowflake-promise/docs/migration-guide/)

---
_Source: https://npm.io/package/snowflake-promise · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
