# snowflake-sdk-promise

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

Latest version **1.0.3** (published 2022-06-08) · MIT license · 0 weekly downloads

## Install

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

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.3 |
| Published | 2022-06-08 |
| First published | 2022-06-08 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Node | >=10 |
| Dependencies | 1 |
| Unpacked size | 48.6 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Tellimer technologies |
| Maintainers | decebal |
| Keywords | snowflake, database, data warehouse, warehouse |

## Links

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

## Dependencies (1)

- [snowflake-sdk](https://npm.io/package/snowflake-sdk.md) 1.6.10

## Recent versions

- 1.0.3 (latest) — 2022-06-08
- 1.0.2 — 2022-06-08
- 1.0.1 — 2022-06-08
- 1.0.0 — 2022-06-08

## README

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

A Promise-based interface to your [Snowflake](https://www.snowflake.net/) data warehouse.

This is a wrapper for the [Snowflake SDK](https://www.npmjs.com/package/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

```typescript
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`
  * 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, 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`
  * `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](examples/streaming.js)
* [Using traditional Promise `then` syntax (and older versions of Node.js)](examples/oldSchool.js)
    * Node v6.9.5 is the oldest supported version
* [Turn on logging](examples/logging.js)
* [Advanced TS Example with Singleton](examples/useLocalInstance.ts)
* [Advanced TS Example with Singleton using a Snowflake Connection Pool](examples/useLocalInstance.ts)

## Credits

This project has started as a fork of [snowflake-promise](https://github.com/natesilva/snowflake-promise)

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