Snowflake connection pool
A Promise-based connection pool for your Snowflake data warehouse.
This is a simple wrapper that enables pooling of Snowflake SDK connections. In addition, this wrapper makes use of the snowflake-promise API which provides a Promise-based API instead of the core callback-based API.
* npm i snowflake-pool
``typescript
const connectionPool = createSnowflakePool({
account: '
username: '
password: '
database: 'SNOWFLAKE_SAMPLE_DATA',
schema: 'SOLUTIONSFIT_TEST',
warehouse: 'DEMO'
});
await connectionPool.use(async (client) => {
const rows = await client.execute(
'SELECT COUNT(*) FROM USERS WHERE FIRSTNAME=:1',
['John']
);
console.log(rows);
});
`
`typescript
const connectionPool = createSnowflakePool({
account: '
username: '
password: '
database: 'SNOWFLAKE_SAMPLE_DATA',
schema: 'SOLUTIONSFIT_TEST',
warehouse: 'DEMO'
}, {
max: 10,
min: 0,
autostart: false,
idleTimeoutMillis: 60 60 1000,
evictionRunIntervalMillis: 60 * 1000,
});
}
await connectionPool.use(async (client) => {
const rows = await client.execute(
'SELECT COUNT(*) FROM USERS WHERE FIRSTNAME=:1',
['John']
);
console.log(rows);
});
`
The createSnowflakePool function takes up to four arguments:
createSnowflakePool(connectionOptions, [ poolOptions, [ loggingOptions, [ configureOptions ] ] ])
* connectionOptionspoolOptions
* Supported options are here:
* validate
* Most supported options are found here under ops:
* (optional, function): If provided will call this function to validate a connection.loggingOptions
* logConnection
* Most supported options are found here under ops:
* (optional, function): If provided, this function will be called to log connection pooling status messages. For example, set logConnection to console.log to log all connection pooling status messages to the console.configureOptions`
*
* Supported options are here: