Disclaimer I am not associated in any way with ScyllaDB or Datastax. Just a guy in need of a good solution to his problems.
Loosely based on the current datastax cassandra driver, it focuses on performance and a cleaner interface.
$ npm install scylladb
Creating a client will spawn multiple forks to allow for more paralel work.
const scylladb = require('scylladb');
const client = scylladb.createClient({
hosts: ['0.0.0.0', '0.0.0.1'],
keyspace: 'ks1'
});
Options
Fields | Description |
---|---|
hosts | List of hosts to connect to. Can be an IP, a fqdn or a unix socket (required) |
keyspace | The keyspace to select (required) |
workers | The number of connection workers to spawn per host (default: 10) |
Querying has been streamlined to now only return a Promise or a Stream.
client.execute('SELECT name, email FROM users WHERE key = ?', [ 'someone' ], { prepare: true })
.then(result => console.log(`User with email ${result.rows[0].email}`));
It can be piped downstream and provides automatic pause/resume logic (it buffers when not read).
client.stream('SELECT time, val FROM temperature WHERE station_id=', [ 'abc' ])
.on('readable', (rows) {
rows.forEach(row => console.log(`time ${row.time} and value ${row.value}`));
})
.on('end', () => console.log('stream ended'));
.on('error', err => console.log(`Error: ${err}`));
ScyllaDB driver uses debug
DEBUG=scylladb:*
The level
being passed to debug can be verbose
, info
, warning
or error
.
I am always looking for maintainers. Reach out to me to get involved.
Once you have a database setup with a keyspace named "test" and a table "users".
Help can be found in the wiki.
Tests can be run with:
npm run test
Apache 2.0 (c) 2017 Frederic Charette