dart_cassandra_cql 0.1.5

  • README.md
  • Installing
  • Versions
  • 4

Dart Driver for Apache Cassandra

Build Status Coverage Status

Dart driver for Apache Cassandra that supports Cassandra Query Language version 3.0+ (CQL3).

The driver has a small dependency tree and implements Cassandra binary protocol (versions 2 and 3) for communicating with Cassandra servers. The protocol and CQL versions to be used are both configurable by the user.


  • Asynchronous API based on Future and Streams
  • Connection management via connection pools
  • Connection load-balancing and failover
  • Server event handling (node/topology/schema change events)
  • Query multiplexing on each connection
  • Batch and prepared queries with either positional or named placeholders
  • Query result streaming
  • Support for all Cassandra types including user defined types (UDT), tuples and custom types (via user-defined Codecs)

Quick start

import "dart:async";
import 'package:dart_cassandra_cql/dart_cassandra_cql.dart' as cql;

void main() {
  // Create a client for connecting to our cluster using native
  // protocol V2 and sensible defaults. The client will setup
  // a connection pool for you and connect automatically when
  // you execute a query.
  cql.Client client = new cql.Client.fromHostList([
      , ""

  // Perform a select with positional bindings
      new cql.Query("SELECT * from test.type_test WHERE id=?", bindings : [123])
  ).then((Iterable<Map<String, Object>> rows) {
    // ...

  // Perform an prepared insert with named bindings, a time-based uuid and tuneable consistency
      new cql.Query("INSERT INTO test.type_test (id, uuid_value) VALUES (:id, :uuid)", bindings : {
          "id" : 1
          , "uuid" : new cql.Uuid.timeBased()
      }, consistency : cql.Consistency.LOCAL_QUORUM
       , prepared : true)
  ).then((cql.ResultMessage res) {
    // ...

  // Perform a batch insert query
      new cql.BatchQuery()
          new cql.Query("INSERT INTO test.type_test (id, uuid_value) VALUES (:id, :uuid)", bindings : {
              "id" : 1
              , "uuid" : new cql.Uuid.timeBased()
          new cql.Query("INSERT INTO test.type_test (id, uuid_value) VALUES (:id, :uuid)", bindings : {
              "id" : 2
              , "uuid" : new cql.Uuid.timeBased()
        ..consistency = cql.Consistency.TWO
  ).then((cql.ResultMessage res) {
    // ...
  }).catchError((e) {
    // Handle errors

  // Stream (paginated) query
  StreamSubscription sub;
  sub = client.stream(
      new cql.Query("SELECT * from test.type_test")
      , pageSize : 200
  ).listen((Map<String, Object> row) {
    // Handle incoming row
    print("Next row: ${row}");
    // ... or manipulate stream



See the Api documentation.


See the Contributing Guide.



dart_cassandra_cql is distributed under the MIT license.

0.1.5 (Feb 18, 2016)

Fixed another socket flush race condition (#2)

0.1.4 (April 17, 2015)

Added the preferBiggerTcpPackets option (defaults to false). When enabled, the driver will join together protocol frame chunks before piping them to the underlying TCP socket. This option will improve performance at the expense of slightly higher memory consumption.

0.1.3 (December 20, 2014)

Improved support for compression codecs Driver is now compatible with dart_lz4

0.1.2 (December 6, 2014)

Renamed lib/driver to lib/src so that docgen works Fixed race condition while flushing data to sockets (#1)

0.1.1 (November 26, 2014)

Restructured folders to align with pub requirements

0.1.0 (November 24, 2014)

Initial release

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:

  dart_cassandra_cql: ^0.1.5

2. Install it

You can install packages from the command line:

with pub:

$ pub get

Alternatively, your editor might support pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:

import 'package:dart_cassandra_cql/dart_cassandra_cql.dart';
Version Uploaded Documentation Archive
0.1.5 Feb 18, 2016 Go to the documentation of dart_cassandra_cql 0.1.5 Download dart_cassandra_cql 0.1.5 archive
0.1.3 Dec 20, 2014 Go to the documentation of dart_cassandra_cql 0.1.3 Download dart_cassandra_cql 0.1.3 archive
0.1.2 Dec 6, 2014 Go to the documentation of dart_cassandra_cql 0.1.2 Download dart_cassandra_cql 0.1.2 archive
0.1.1 Nov 26, 2014 Go to the documentation of dart_cassandra_cql 0.1.1 Download dart_cassandra_cql 0.1.1 archive
0.1.0 Nov 26, 2014 Go to the documentation of dart_cassandra_cql 0.1.0 Download dart_cassandra_cql 0.1.0 archive
Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
Learn more about scoring.

The package version is not analyzed, because it does not support Dart 2. Until this is resolved, the package will receive a health and maintenance score of 0.

Analysis issues and suggestions

Support Dart 2 in pubspec.yaml.

The SDK constraint in pubspec.yaml doesn't allow the Dart 2.0.0 release. For information about upgrading it to be Dart 2 compatible, please see https://www.dartlang.org/dart-2#migration.


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=1.8.0 <2.0.0