DataStax Python Driver 2.0 Released
We are excited to announce the public release of version 2.0 of the DataStax Python driver for Apache Cassandra and DataStax Enterprise. The driver has several new features in this version:
- Full Apache Cassandra 2.0 and DataStax Enterprise 4.0 support
- Automatic paging of large result sets
- Protocol-level statement batching
- Lightweight transactions
- SASL-based authentication
- Enhanced stability and many minor improvements
- Python 3 support
The Upgrade Guide contains details about new features and other changes. I’ll give some examples of how to use the new features here.
Automatic pagination of results
If a query yields a very large number of results, only an initial amount of rows will be fetched (according to the page size). The rest of the rows will be fetched on demand as you iterate through the rows in the result set.
For more details, see the documentation for query paging.
Using Cassandra 2.0’s lightweight transactions is simple:
Although it has always been possible to execute statements in a BATCH, there was no way to do this with multiple prepared statements. With version 2.0 of the driver, you can execute multiple prepared (or unprepared) statements atomically across multiple tables within a single batch.
Note that the while version 2.0 supports the new Cassandra 2.0 features, this new version of the driver works with Apache Cassandra 1.2 and 2.0, and DataStax Enterprise 4.0, 3.2, and 3.1. When working with Cassandra 1.2 and DSE 3.x, you should explicitly set the protocol version to 1:
When using protocol version 1, lightweight transactions, automatic paging, and protocol-level batches are not available.