Skip to content

Commit 543b278

Browse files
committed
Merge branch 'master' into ngdg_master_ft
2 parents 11ac6bb + 1f3fa3b commit 543b278

29 files changed

+305
-256
lines changed

CHANGELOG.rst

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
3.22.0
22
======
3-
Unreleased
3+
UNRELEASED
44

55
Features
66
--------
77

8+
* Add all() function to the ResultSet API (PYTHON-1203)
89
* Parse new schema metadata in NGDG and generate table edges CQL syntax (PYTHON-996)
910
* Add GraphSON3 support (PYTHON-788)
1011
* Use GraphSON3 as default for Native graphs (PYTHON-1004)
@@ -25,25 +26,23 @@ Features
2526

2627
3.21.0
2728
======
28-
Unreleased
29+
January 15, 2020
2930

3031
Features
3132
--------
33+
* Unified driver: merge core and DSE drivers into a single package (PYTHON-1130)
34+
* Add Python 3.8 support (PYTHON-1189)
3235
* Allow passing ssl context for Twisted (PYTHON-1161)
33-
* ssl context and cloud support for Eventlet (PYTHON-1162)
36+
* Ssl context and cloud support for Eventlet (PYTHON-1162)
3437
* Cloud Twisted support (PYTHON-1163)
3538
* Add additional_write_policy and read_repair to system schema parsing (PYTHON-1048)
36-
* Handle prepared id mismatch when repreparing on the fly (PYTHON-1124)
37-
* Remove *read_repair_chance table options (PYTHON-1140)
3839
* Flexible version parsing (PYTHON-1174)
3940
* Support NULL in collection deserializer (PYTHON-1123)
40-
* Avoid warnings about unspecified load balancing policy when connecting to a cloud cluster (PYTHON-1177)
41-
* Add Python 3.8 support (PYTHON-1189)
42-
* Add new DSE CQL keywords (PYTHON-1122)
4341
* [GRAPH] Ability to execute Fluent Graph queries asynchronously (PYTHON-1129)
4442

4543
Bug Fixes
4644
---------
45+
* Handle prepared id mismatch when repreparing on the fly (PYTHON-1124)
4746
* re-raising the CQLEngineException will fail on Python 3 (PYTHON-1166)
4847
* asyncio message chunks can be processed discontinuously (PYTHON-1185)
4948
* Reconnect attempts persist after downed node removed from peers (PYTHON-1181)
@@ -55,6 +54,10 @@ Others
5554
------
5655
* The driver has a new dependency: geomet. It comes from the dse-driver unification and
5756
is used to support DSE geo types.
57+
* Remove *read_repair_chance table options (PYTHON-1140)
58+
* Avoid warnings about unspecified load balancing policy when connecting to a cloud cluster (PYTHON-1177)
59+
* Add new DSE CQL keywords (PYTHON-1122)
60+
* Publish binary wheel distributions (PYTHON-1013)
5861
5962
Deprecations
6063
------------

cassandra/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ def emit(self, record):
2222

2323
logging.getLogger('cassandra').addHandler(NullHandler())
2424

25-
__version_info__ = (3, '21a1+20191210')
25+
__version_info__ = (3, 21, 0, 'post0+20200123')
2626
__version__ = '.'.join(map(str, __version_info__))
2727

2828

cassandra/cluster.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2543,6 +2543,7 @@ def __init__(self, cluster, hosts, keyspace=None):
25432543
msg += " using keyspace '%s'" % self.keyspace
25442544
raise NoHostAvailable(msg, [h.address for h in hosts])
25452545

2546+
self.session_id = uuid.uuid4()
25462547
self._graph_paging_available = self._check_graph_paging_available()
25472548

25482549
cc_host = self.cluster.get_control_connection_host()
@@ -2558,7 +2559,6 @@ def __init__(self, cluster, hosts, keyspace=None):
25582559
'not supported by server version {v} on '
25592560
'ControlConnection host {c}'.format(v=cc_host.release_version, c=cc_host))
25602561

2561-
self.session_id = uuid.uuid4()
25622562
log.debug('Started Session with client_id {} and session_id {}'.format(self.cluster.client_id,
25632563
self.session_id))
25642564

@@ -5026,6 +5026,15 @@ def current_rows(self):
50265026
"""
50275027
return self._current_rows or []
50285028

5029+
def all(self):
5030+
"""
5031+
Returns all the remaining rows as a list. This is basically
5032+
a convenient shortcut to `list(result_set)`.
5033+
5034+
This function is not recommended for queries that return a large number of elements.
5035+
"""
5036+
return list(self)
5037+
50295038
def one(self):
50305039
"""
50315040
Return a single row of the results or None if empty. This is basically

docs.yaml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
title: DataStax Python Driver for Apache Cassandra
2-
summary: DataStax Python Driver for Apache Cassandra Documentation
1+
title: DataStax Python Driver
2+
summary: DataStax Python Driver for Apache Cassandra®
33
output: docs/_build/
44
swiftype_drivers: pythondrivers
55
checks:
@@ -13,7 +13,7 @@ sections:
1313
directory: docs
1414
virtualenv_init: |
1515
set -x
16-
CASS_DRIVER_NO_CYTHON=1 pip install -r test-requirements.txt
16+
CASS_DRIVER_NO_CYTHON=1 pip install -r test-datastax-requirements.txt
1717
# for newer versions this is redundant, but in older versions we need to
1818
# install, e.g., the cassandra driver, and those versions don't specify
1919
# the cassandra driver version in requirements files
@@ -22,6 +22,8 @@ sections:
2222
# build extensions like libev
2323
CASS_DRIVER_NO_CYTHON=1 python setup.py build_ext --inplace --force
2424
versions:
25+
- name: '3.21'
26+
ref: 5589d96b
2527
- name: '3.20'
2628
ref: d30d166f
2729
- name: '3.19'

docs/getting_started.rst

Lines changed: 26 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -40,14 +40,35 @@ behavior in some other way, this is the place to do it:
4040

4141
.. code-block:: python
4242
43-
from cassandra.cluster import Cluster, ExecutionProfile, EXEC_PROFILE_DEFAULT
44-
from cassandra.query import tuple_factory
43+
from cassandra.cluster import Cluster
44+
cluster = Cluster(['192.168.0.1', '192.168.0.2'], port=..., ssl_context=...)
4545
46-
profile = ExecutionProfile(row_factory=tuple_factory)
47-
cluster = Cluster(execution_profiles={EXEC_PROFILE_DEFAULT: profile})
46+
Instantiating a :class:`~.Cluster` does not actually connect us to any nodes.
47+
To establish connections and begin executing queries we need a
48+
:class:`~.Session`, which is created by calling :meth:`.Cluster.connect()`:
49+
50+
.. code-block:: python
51+
52+
cluster = Cluster()
4853
session = cluster.connect()
4954
50-
print(session.execute("SELECT release_version FROM system.local").one())
55+
The :meth:`~.Cluster.connect()` method takes an optional ``keyspace`` argument
56+
which sets the default keyspace for all queries made through that :class:`~.Session`:
57+
58+
.. code-block:: python
59+
60+
cluster = Cluster()
61+
session = cluster.connect('mykeyspace')
62+
63+
64+
You can always change a Session's keyspace using :meth:`~.Session.set_keyspace` or
65+
by executing a ``USE <keyspace>`` query:
66+
67+
.. code-block:: python
68+
69+
session.set_keyspace('users')
70+
# or you can do this instead
71+
session.execute('USE users')
5172
5273
Profiles are passed in by ``execution_profiles`` dict.
5374

@@ -83,33 +104,6 @@ Users are free to setup additional profiles to be used by name:
83104
84105
Also, parameters passed to ``Session.execute`` or attached to ``Statement``\s are still honored as before.
85106

86-
Instantiating a :class:`~.Cluster` does not actually connect us to any nodes.
87-
To establish connections and begin executing queries we need a
88-
:class:`~.Session`, which is created by calling :meth:`.Cluster.connect()`:
89-
90-
.. code-block:: python
91-
92-
cluster = Cluster()
93-
session = cluster.connect()
94-
95-
The :meth:`~.Cluster.connect()` method takes an optional ``keyspace`` argument
96-
which sets the default keyspace for all queries made through that :class:`~.Session`:
97-
98-
.. code-block:: python
99-
100-
cluster = Cluster()
101-
session = cluster.connect('mykeyspace')
102-
103-
104-
You can always change a Session's keyspace using :meth:`~.Session.set_keyspace` or
105-
by executing a ``USE <keyspace>`` query:
106-
107-
.. code-block:: python
108-
109-
session.set_keyspace('users')
110-
# or you can do this instead
111-
session.execute('USE users')
112-
113107
Executing Queries
114108
-----------------
115109
Now that we have a :class:`.Session` we can begin to execute queries. The simplest

docs/graph_fluent.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
DataStax Graph Fluent API
22
=========================
33

4-
The fluent API adds graph features to the core driver::
4+
The fluent API adds graph features to the core driver:
55

66
* A TinkerPop GraphTraversalSource builder to execute traversals on a DSE cluster
77
* The ability to execution traversal queries explicitly using execute_graph

docs/index.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
DataStax Python Driver for Apache Cassandra
2-
===========================================
3-
A Python client driver for `Apache Cassandra <http://cassandra.apache.org>`_.
1+
DataStax Python Driver for Apache Cassandra®
2+
============================================
3+
A Python client driver for `Apache Cassandra® <http://cassandra.apache.org>`_.
44
This driver works exclusively with the Cassandra Query Language v3 (CQL3)
55
and Cassandra's native protocol. Cassandra 2.1+ is supported, including DSE 4.7+.
66

docs/installation.rst

Lines changed: 48 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,54 @@ You can use ``pip install --pre cassandra-driver`` if you need to install a beta
2020

2121
***Note**: if intending to use optional extensions, install the `dependencies <#optional-non-python-dependencies>`_ first. The driver may need to be reinstalled if dependencies are added after the initial installation.
2222

23+
Verifying your Installation
24+
---------------------------
25+
To check if the installation was successful, you can run::
26+
27+
python -c 'import cassandra; print cassandra.__version__'
28+
29+
It should print something like "3.21.0".
30+
31+
.. _installation-datastax-graph:
32+
33+
(*Optional*) DataStax Graph
34+
---------------------------
35+
The driver provides an optional fluent graph API that depends on Apache TinkerPop (gremlinpython). It is
36+
not installed by default. To be able to build Gremlin traversals, you need to install
37+
the `graph` requirements::
38+
39+
pip install cassandra-driver[graph]
40+
41+
See :doc:`graph_fluent` for more details about this API.
42+
43+
(*Optional*) Compression Support
44+
--------------------------------
45+
Compression can optionally be used for communication between the driver and
46+
Cassandra. There are currently two supported compression algorithms:
47+
snappy (in Cassandra 1.2+) and LZ4 (only in Cassandra 2.0+). If either is
48+
available for the driver and Cassandra also supports it, it will
49+
be used automatically.
50+
51+
For lz4 support::
52+
53+
pip install lz4
54+
55+
For snappy support::
56+
57+
pip install python-snappy
58+
59+
(If using a Debian Linux derivative such as Ubuntu, it may be easier to
60+
just run ``apt-get install python-snappy``.)
61+
62+
(*Optional*) Metrics Support
63+
----------------------------
64+
The driver has built-in support for capturing :attr:`.Cluster.metrics` about
65+
the queries you run. However, the ``scales`` library is required to
66+
support this::
67+
68+
pip install scales
69+
70+
2371
Speeding Up Installation
2472
^^^^^^^^^^^^^^^^^^^^^^^^
2573

@@ -80,53 +128,6 @@ Once the dependencies are installed, simply run::
80128

81129
python setup.py install
82130

83-
Verifying your Installation
84-
---------------------------
85-
To check if the installation was successful, you can run::
86-
87-
python -c 'import cassandra; print cassandra.__version__'
88-
89-
It should print something like "2.7.0".
90-
91-
.. _installation-datastax-graph:
92-
93-
(*Optional*) DataStax Graph
94-
---------------------------
95-
The driver provides an optional fluent graph API that depends on Apache TinkerPop (gremlinpython). It is
96-
not installed by default. To be able to build Gremlin traversals, you need to install
97-
the `graph` requirements::
98-
99-
pip install cassandra-driver[graph]
100-
101-
See :doc:`graph_fluent` for more details about this API.
102-
103-
(*Optional*) Compression Support
104-
--------------------------------
105-
Compression can optionally be used for communication between the driver and
106-
Cassandra. There are currently two supported compression algorithms:
107-
snappy (in Cassandra 1.2+) and LZ4 (only in Cassandra 2.0+). If either is
108-
available for the driver and Cassandra also supports it, it will
109-
be used automatically.
110-
111-
For lz4 support::
112-
113-
pip install lz4
114-
115-
For snappy support::
116-
117-
pip install python-snappy
118-
119-
(If using a Debian Linux derivative such as Ubuntu, it may be easier to
120-
just run ``apt-get install python-snappy``.)
121-
122-
(*Optional*) Metrics Support
123-
----------------------------
124-
The driver has built-in support for capturing :attr:`.Cluster.metrics` about
125-
the queries you run. However, the ``scales`` library is required to
126-
support this::
127-
128-
pip install scales
129-
130131

131132
(*Optional*) Non-python Dependencies
132133
------------------------------------

docs/query_paging.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,10 +86,10 @@ You can resume the pagination when executing a new query by using the :attr:`.Re
8686
results = session.execute(statement)
8787

8888
# save the paging_state somewhere and return current results
89-
session['paging_stage'] = results.paging_state
89+
web_session['paging_stage'] = results.paging_state
9090

9191

9292
# resume the pagination sometime later...
9393
statement = SimpleStatement(query, fetch_size=10)
94-
ps = session['paging_state']
94+
ps = web_session['paging_state']
9595
results = session.execute(statement, paging_state=ps)

docs/security.rst

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,10 @@ SSL Configuration Examples
9999
^^^^^^^^^^^^^^^^^^^^^^^^^^
100100
Here, we'll describe the server and driver configuration necessary to set up SSL to meet various goals, such as the client verifying the server and the server verifying the client. We'll also include Python code demonstrating how to use servers and drivers configured in these ways.
101101

102-
**No identity verification**
102+
.. _ssl-no-identify-verification:
103+
104+
No identity verification
105+
++++++++++++++++++++++++
103106

104107
No identity verification at all. Note that this is not recommended for for production deployments.
105108

@@ -123,7 +126,10 @@ The driver configuration:
123126
cluster = Cluster(['127.0.0.1'], ssl_context=ssl_context)
124127
session = cluster.connect()
125128
126-
**Client verifies server**
129+
.. _ssl-client-verifies-server:
130+
131+
Client verifies server
132+
++++++++++++++++++++++
127133

128134
Ensure the python driver verifies the identity of the server.
129135

@@ -166,7 +172,10 @@ Additionally, you can also force the driver to verify the `hostname` of the serv
166172
cluster = Cluster(['127.0.0.1'], ssl_context=ssl_context, ssl_options=ssl_options)
167173
session = cluster.connect()
168174
169-
**Server verifies client**
175+
.. _ssl-server-verifies-client:
176+
177+
Server verifies client
178+
++++++++++++++++++++++
170179

171180
If Cassandra is configured to verify clients (``require_client_auth``), you need to generate
172181
SSL key and certificate files.
@@ -229,8 +238,10 @@ Finally, you can use that configuration with the following driver code:
229238
cluster = Cluster(['127.0.0.1'], ssl_context=ssl_context)
230239
session = cluster.connect()
231240
241+
.. _ssl-server-client-verification:
232242
233-
**Server verifies client and client verifies server**
243+
Server verifies client and client verifies server
244+
+++++++++++++++++++++++++++++++++++++++++++++++++
234245
235246
See the previous section for examples of Cassandra configuration and preparing
236247
the client certificates.

0 commit comments

Comments
 (0)