|
| 1 | +Upgrading |
| 2 | +========= |
| 3 | + |
| 4 | +Upgrading to 2.0 from 1.x |
| 5 | +------------------------- |
| 6 | +Version 2.0 of the DataStax python driver for Apache Cassandra |
| 7 | +includes some notable improvements over version 1.x. This version |
| 8 | +of the driver supports Cassandra 1.2, 2.0, and 2.1. However, not |
| 9 | +all features may be used with Cassandra 1.2, and some new features |
| 10 | +in 2.1 are not yet supported. |
| 11 | + |
| 12 | +Using the v2 Native Protocol |
| 13 | +^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 14 | +By default, the driver will attempt to use version 2 of Cassandra's |
| 15 | +native protocol. When working with Cassandra 1.2, you will need to |
| 16 | +explicitly set the :attr:`~.Cluster.protocol_version` to 1: |
| 17 | + |
| 18 | +.. code-block:: python |
| 19 | +
|
| 20 | + from cassandra.cluster import Cluster |
| 21 | +
|
| 22 | + cluster = Cluster(protocol_version=1) |
| 23 | +
|
| 24 | +Automatic Query Paging |
| 25 | +^^^^^^^^^^^^^^^^^^^^^^ |
| 26 | +Version 2 of the native protocol adds support for automatic query |
| 27 | +paging, which can make dealing with large result sets much simpler. |
| 28 | + |
| 29 | +See :ref:`query-paging` for full details. |
| 30 | + |
| 31 | +Protocol-Level Batch Statements |
| 32 | +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 33 | +With version 1 of the native protocol, batching of statements required |
| 34 | +using a `BATCH cql query <http://cassandra.apache.org/doc/cql3/CQL.html#batchStmt>`_. |
| 35 | +With version 2 of the native protocol, you can now batch statements at |
| 36 | +the protocol level. This allows you to use many different prepared |
| 37 | +statements within a single batch. |
| 38 | + |
| 39 | +See :class:`~.query.BatchStatement` for details and usage examples. |
| 40 | + |
| 41 | +SASL-based Authentication |
| 42 | +^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 43 | +Also new in version 2 of the native protocol is SASL-based authentication. |
| 44 | +See the section on :ref:`security` for details and examples. |
| 45 | + |
| 46 | +Lightweight Transactions |
| 47 | +^^^^^^^^^^^^^^^^^^^^^^^^ |
| 48 | +`Lightweight transactions <http://www.datastax.com/dev/blog/lightweight-transactions-in-cassandra-2-0>`_ are another new feature. To use lightweight transactions, add ``IF`` clauses |
| 49 | +to your CQL queries and set the :attr:`~.Statement.serial_consistency_level` |
| 50 | +on your statements. |
| 51 | + |
| 52 | +Deprecations |
| 53 | +^^^^^^^^^^^^ |
| 54 | +The following functions have moved from ``cassandra.decoder`` to ``cassandra.query``. |
| 55 | +The original functions have been left in place with a :exc:`DeprecationWarning` for |
| 56 | +now: |
| 57 | + |
| 58 | +* :attr:`cassandra.decoder.tuple_factory` has moved to |
| 59 | + :attr:`cassandra.query.tuple_factory` |
| 60 | +* :attr:`cassandra.decoder.named_tuple_factory` has moved to |
| 61 | + :attr:`cassandra.query.named_tuple_factory |
| 62 | +* :attr:`cassandra.decoder.dict_factory` has moved to |
| 63 | + :attr:`cassandra.query.dict_factory` |
| 64 | +* :attr:`cassandra.decoder.ordered_dict_factory` has moved to |
| 65 | + :attr:`cassandra.query.ordered_dict_factory` |
| 66 | + |
| 67 | +Dependency Changes |
| 68 | +^^^^^^^^^^^^^^^^^^ |
| 69 | +The following dependencies have officially been made optional: |
| 70 | + |
| 71 | +* ``scales`` |
| 72 | +* ``blist`` |
| 73 | + |
| 74 | +And one new dependency has been added (to enable Python 3 support): |
| 75 | + |
| 76 | +* ``six`` |
0 commit comments