Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including promised-cassandra with all npm packages installed. Try it out:

var promisedCassandra = require("promised-cassandra")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

promised-cassandra v0.2.0

Q promise wrapper for Datastax Cassandra driver

Promised Cassandra

Q promise wrapper for Datastax Cassandra driver

Depends on node v6


npm install --save cassandra-driver promised-cassandra

Featured Cassandra driver functions

Everything. It's proxying the Cassandra driver.

But everything is not tested though.

Tested Cassandra driver functions

  • execute
  • eachRow

Basic usage

// Initiate cassandra connection
const cassandra = require('promised-cassandra');
// If no connection options are passed, connection will default to localhost
// or use CASSANDRA_CONTACT_POINTS environment variable.
const database = cassandra({
    contactPoints: ['']
// or if your options comes from a promise
const database = cassandra(some_promise_that_resolves_an_options_object);

// Execute some CQL
    'SELECT email FROM users WHERE id=?',
.then(result => {
    // result.rows
    // result.first().email

// Run eachRow
database.eachRow('SELECT email FROM users', null, (row => {
.then(result => {
    // result.rows

Some extra functions

// Create a keyspace if it doesn't already exist and start using it
    'keyspace-name', // Keyspace name
    {class: 'SimpleStrategy', replication_factor: 1}, // Replication options
    false // Durable writes
.then(() => {
    // Keyspace created

// Create table if it doesn't already exist
        id: 'uuid PRIMARY KEY',
        column: 'text'
.then(() => {
    // Table created
RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free