Home

The DSE driver is built on top of Node.js CQL driver for Apache Cassandra and provides the following extensions for DataStax Enterprise:

Getting Started

Client inherits from the CQL driver counterpart. All CQL features available to Client (see the CQL driver manual) can also be used with the Client of the DSE module.

const dse = require('dse-driver');
const client = new dse.Client({
  contactPoints: ['h1', 'h2'],
  keyspace: 'ks1',
  graphOptions: { name: 'graph1' }
});
const query = 'SELECT email, last_name FROM users WHERE key=?';
client.execute(query, ['guy'], function(err, result) {
  assert.ifError(err);
  console.log('User email ' + result.rows[0].email);
});

Additionally, the DSE module exports the submodules from the CQL driver, so you just need to import one module to access all DSE and Cassandra types.

For example:

const Uuid = dse.types.Uuid;
let id = Uuid.random();

Graph

Client includes a executeGraph() method to execute graph queries:

client.executeGraph('g.V()', function (err, result) {
  assert.ifError(err);
  const vertex = result.first();
  console.log(vertex.label);
});