CQLEngine Now Using the Python Native Driver

I’m happy to announce that cqlengine is now using the Python Native Driver. For the most part, this should be a trivial upgrade. See the notes below on upgrading.

The Good News

  • Significantly less code to maintain in cqlengine itself. We no longer need to maintain connection pools, deal with fail over, dead servers, server discovery, server removal
  • Native driver multiplexes queries over each socket, so less sockets stay open
  • Notifications can be sent back to the client from the server. An example of this is a schema modification or when a new server is added.
  • You can now use the policies for load balancing and failover. See the policies api of the native driver for more information.

Upgrading

If you’re using an earlier version of cqlengine, there are a few caveats to upgrading.

  • We no longer raise cqlengine based OperationalError when connection fails. We’re now using the exception thrown in the native driver.
  • setup()’s arguments are now passed to the Cluser() of the native driver. See the new examples in the readme.
  • The cqlengine connection pool has been removed. Connections are now managed by the native driver. This should drastically reduce the socket overhead as the native driver can multiplex queries.
  • If you were previously manually using “ALL”, “QUORUM”, etc, to specificy consistency levels, you will need to migrate to the cqlengine.ALL, QUORUM, etc instead. If you had been using the module level constants before, nothing should need to change.
  • cqlengine no longer accepts username & password as arguments to setup. Use the native driver’s authentication instead. See

Compatibility

Cqlengine is tested with Python 2.7 and Cassandra 1.2 as well as Cassandra 2.0. This if the first release that’s been explicitly tested with Cassandra 2.0 as well as 1.2.

Going Forward

The next release will focus on usability and documentation. If there’s something that’s not clear, now is a good time to file an issue in github!

If you found this post helpful, please consider sharing to your network. I'm also available to help you be successful with your distributed systems! Please reach out if you're interested in working with me, and I'll be happy to schedule a free one-hour consultation.