Skip to content

Commit 8953796

Browse files
committed
Merge tag '3.28.0' of https://github.com/datastax/python-driver into sync_with_upstream_3.29.1
version 3.28.0 * tag '3.28.0' of https://github.com/datastax/python-driver: Release 3.28.0: changelog & version PYTHON-1352 Add vector type, codec + support for parsing CQL type (datastax#1161) Update docs.yaml to point to most recent 3.27.0 docs changes CONN-38 Notes for 3.27.0 on PYTHON-1350 (datastax#1166) PYTHON-1356 Create session-specific protocol handlers to contain session-specific CLE policies (datastax#1165) PYTHON-1350 Store IV along with encrypted text when using column-level encryption (datastax#1160) PYTHON-1351 Convert cryptography to an optional dependency (datastax#1164) Jenkinsfile cleanup (datastax#1163) PYTHON-1343 Use Cython for smoke builds (datastax#1162) Don't fail when inserting UDTs with prepared queries with some missing fields (datastax#1151) Revert "remove unnecessary import __future__ (datastax#1156)" docs: convert print statement to function in docs (datastax#1157) remove unnecessary import __future__ (datastax#1156) Update docs.yaml to include recent fixes to CLE docs Fix for rendering of code blocks in CLE documentation (datastax#1159) DOC-3278 Update comment for retry policy (datastax#1158) DOC-2813 (datastax#1145) Remove different build matrix selection for develop branches (datastax#1138)
2 parents c69935e + e3400a1 commit 8953796

31 files changed

+718
-437
lines changed

CHANGELOG.rst

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,25 @@
1+
3.28.0
2+
======
3+
June 5, 2023
4+
5+
Features
6+
--------
7+
* Add support for vector type (PYTHON-1352)
8+
* Cryptography module is now an optional dependency (PYTHON-1351)
9+
10+
Bug Fixes
11+
---------
12+
* Store IV along with encrypted text when using column-level encryption (PYTHON-1350)
13+
* Create session-specific protocol handlers to contain session-specific CLE policies (PYTHON-1356)
14+
15+
Others
16+
------
17+
* Use Cython for smoke builds (PYTHON-1343)
18+
* Don't fail when inserting UDTs with prepared queries with some missing fields (PR 1151)
19+
* Convert print statement to function in docs (PR 1157)
20+
* Update comment for retry policy (DOC-3278)
21+
* Added error handling blog reference (DOC-2813)
22+
123
3.27.0
224
======
325
May 1, 2023

Jenkinsfile

Lines changed: 33 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,10 @@ Test Profiles:
1313
Matrix Types:
1414
1515
Full: All server versions, python runtimes tested with and without Cython.
16-
Develop: Smaller matrix for dev purpose.
1716
Cassandra: All cassandra server versions.
1817
Dse: All dse server versions.
18+
Smoke: CI-friendly configurations. Currently-supported Python version + modern Cassandra/DSE instances.
19+
We also avoid cython since it's tested as part of the nightlies
1920
2021
Parameters:
2122
@@ -29,35 +30,30 @@ import com.datastax.jenkins.drivers.python.Slack
2930

3031
slack = new Slack()
3132

32-
// Define our predefined matrices
33-
//
34-
// Smoke tests are CI-friendly test configuration. Currently-supported Python version + modern C*/DSE instances.
35-
// We also avoid cython since it's tested as part of the nightlies.
33+
DEFAULT_CASSANDRA = ['2.1', '2.2', '3.0', '3.11', '4.0']
34+
DEFAULT_DSE = ['dse-5.0.15', 'dse-5.1.35', 'dse-6.0.18', 'dse-6.7.17', 'dse-6.8.30']
35+
DEFAULT_RUNTIME = ['3.7.7', '3.8.3']
36+
DEFAULT_CYTHON = ["True", "False"]
3637
matrices = [
3738
"FULL": [
38-
"SERVER": ['2.1', '2.2', '3.0', '3.11', '4.0', 'dse-5.0.15', 'dse-5.1.35', 'dse-6.0.18', 'dse-6.7.17', 'dse-6.8.30'],
39-
"RUNTIME": ['2.7.18', '3.5.9', '3.6.10', '3.7.7', '3.8.3'],
40-
"CYTHON": ["True", "False"]
41-
],
42-
"DEVELOP": [
43-
"SERVER": ['2.1', '3.11', 'dse-6.8.30'],
44-
"RUNTIME": ['2.7.18', '3.6.10'],
45-
"CYTHON": ["True", "False"]
39+
"SERVER": DEFAULT_CASSANDRA + DEFAULT_DSE,
40+
"RUNTIME": DEFAULT_RUNTIME,
41+
"CYTHON": DEFAULT_CYTHON
4642
],
4743
"CASSANDRA": [
48-
"SERVER": ['2.1', '2.2', '3.0', '3.11', '4.0'],
49-
"RUNTIME": ['2.7.18', '3.5.9', '3.6.10', '3.7.7', '3.8.3'],
50-
"CYTHON": ["True", "False"]
44+
"SERVER": DEFAULT_CASSANDRA,
45+
"RUNTIME": DEFAULT_RUNTIME,
46+
"CYTHON": DEFAULT_CYTHON
5147
],
5248
"DSE": [
53-
"SERVER": ['dse-5.0.15', 'dse-5.1.35', 'dse-6.0.18', 'dse-6.7.17', 'dse-6.8.30'],
54-
"RUNTIME": ['2.7.18', '3.5.9', '3.6.10', '3.7.7', '3.8.3'],
55-
"CYTHON": ["True", "False"]
49+
"SERVER": DEFAULT_DSE,
50+
"RUNTIME": DEFAULT_RUNTIME,
51+
"CYTHON": DEFAULT_CYTHON
5652
],
5753
"SMOKE": [
58-
"SERVER": ['3.11', '4.0', 'dse-6.8.30'],
59-
"RUNTIME": ['3.7.7', '3.8.3'],
60-
"CYTHON": ["True", "False"]
54+
"SERVER": DEFAULT_CASSANDRA.takeRight(2) + DEFAULT_DSE.takeRight(1),
55+
"RUNTIME": DEFAULT_RUNTIME.takeRight(2),
56+
"CYTHON": ["True"]
6157
]
6258
]
6359

@@ -84,24 +80,13 @@ def getBuildContext() {
8480
Based on schedule and parameters, configure the build context and env vars.
8581
*/
8682

87-
def profile = "${params.PROFILE}"
83+
def PROFILE = "${params.PROFILE}"
8884
def EVENT_LOOP = "${params.EVENT_LOOP.toLowerCase()}"
89-
matrixType = "SMOKE"
90-
developBranchPattern = ~"((dev|long)-)?python-.*"
9185

92-
if (developBranchPattern.matcher(env.BRANCH_NAME).matches()) {
93-
matrixType = "DEVELOP"
94-
if (env.BRANCH_NAME.contains("long")) {
95-
profile = "FULL"
96-
}
97-
}
86+
matrixType = params.MATRIX != "DEFAULT" ? params.MATRIX : "SMOKE"
87+
matrix = matrices[matrixType].clone()
9888

9989
// Check if parameters were set explicitly
100-
if (params.MATRIX != "DEFAULT") {
101-
matrixType = params.MATRIX
102-
}
103-
104-
matrix = matrices[matrixType].clone()
10590
if (params.CYTHON != "DEFAULT") {
10691
matrix["CYTHON"] = [params.CYTHON]
10792
}
@@ -121,7 +106,7 @@ def getBuildContext() {
121106

122107
context = [
123108
vars: [
124-
"PROFILE=${profile}",
109+
"PROFILE=${PROFILE}",
125110
"EVENT_LOOP=${EVENT_LOOP}"
126111
],
127112
matrix: matrix
@@ -401,8 +386,9 @@ def describeBuild(buildContext) {
401386
}
402387
}
403388

404-
def scheduleTriggerJobName() {
405-
"drivers/python/oss/master/disabled"
389+
// branch pattern for cron
390+
def branchPatternCron() {
391+
~"(master)"
406392
}
407393

408394
pipeline {
@@ -467,7 +453,7 @@ pipeline {
467453
</table>''')
468454
choice(
469455
name: 'MATRIX',
470-
choices: ['DEFAULT', 'SMOKE', 'FULL', 'DEVELOP', 'CASSANDRA', 'DSE'],
456+
choices: ['DEFAULT', 'SMOKE', 'FULL', 'CASSANDRA', 'DSE'],
471457
description: '''<p>The matrix for the build.</p>
472458
<table style="width:100%">
473459
<col width="25%">
@@ -488,10 +474,6 @@ pipeline {
488474
<td><strong>FULL</strong></td>
489475
<td>All server versions, python runtimes tested with and without Cython.</td>
490476
</tr>
491-
<tr>
492-
<td><strong>DEVELOP</strong></td>
493-
<td>Smaller matrix for dev purpose.</td>
494-
</tr>
495477
<tr>
496478
<td><strong>CASSANDRA</strong></td>
497479
<td>All cassandra server versions.</td>
@@ -503,22 +485,11 @@ pipeline {
503485
</table>''')
504486
choice(
505487
name: 'PYTHON_VERSION',
506-
choices: ['DEFAULT', '2.7.18', '3.5.9', '3.6.10', '3.7.7', '3.8.3'],
488+
choices: ['DEFAULT'] + DEFAULT_RUNTIME,
507489
description: 'Python runtime version. Default to the build context.')
508490
choice(
509491
name: 'SERVER_VERSION',
510-
choices: ['DEFAULT',
511-
'2.1', // Legacy Apache CassandraⓇ
512-
'2.2', // Legacy Apache CassandraⓇ
513-
'3.0', // Previous Apache CassandraⓇ
514-
'3.11', // Current Apache CassandraⓇ
515-
'4.0', // Development Apache CassandraⓇ
516-
'dse-5.0.15', // Long Term Support DataStax Enterprise
517-
'dse-5.1.35', // Legacy DataStax Enterprise
518-
'dse-6.0.18', // Previous DataStax Enterprise
519-
'dse-6.7.17', // Previous DataStax Enterprise
520-
'dse-6.8.30', // Current DataStax Enterprise
521-
],
492+
choices: ['DEFAULT'] + DEFAULT_CASSANDRA + DEFAULT_DSE,
522493
description: '''Apache CassandraⓇ and DataStax Enterprise server version to use for adhoc <b>BUILD-AND-EXECUTE-TESTS</b> <strong>ONLY!</strong>
523494
<table style="width:100%">
524495
<col width="15%">
@@ -549,7 +520,7 @@ pipeline {
549520
</tr>
550521
<tr>
551522
<td><strong>4.0</strong></td>
552-
<td>Apache CassandraⓇ v4.x (<b>CURRENTLY UNDER DEVELOPMENT</b>)</td>
523+
<td>Apache CassandraⓇ v4.0.x</td>
553524
</tr>
554525
<tr>
555526
<td><strong>dse-5.0.15</strong></td>
@@ -574,7 +545,7 @@ pipeline {
574545
</table>''')
575546
choice(
576547
name: 'CYTHON',
577-
choices: ['DEFAULT', 'True', 'False'],
548+
choices: ['DEFAULT'] + DEFAULT_CYTHON,
578549
description: '''<p>Flag to determine if Cython should be enabled</p>
579550
<table style="width:100%">
580551
<col width="25%">
@@ -647,10 +618,10 @@ pipeline {
647618
}
648619

649620
triggers {
650-
parameterizedCron((scheduleTriggerJobName() == env.JOB_NAME) ? """
621+
parameterizedCron(branchPatternCron().matcher(env.BRANCH_NAME).matches() ? """
651622
# Every weeknight (Monday - Friday) around 4:00 AM
652-
# These schedules will run with and without Cython enabled for Python v2.7.18 and v3.5.9
653-
H 4 * * 1-5 %CI_SCHEDULE=WEEKNIGHTS;EVENT_LOOP=LIBEV;CI_SCHEDULE_PYTHON_VERSION=2.7.18 3.5.9;CI_SCHEDULE_SERVER_VERSION=2.2 3.11 dse-5.1.35 dse-6.0.18 dse-6.7.17
623+
# These schedules will run with and without Cython enabled for Python 3.7.7 and 3.8.3
624+
H 4 * * 1-5 %CI_SCHEDULE=WEEKNIGHTS;EVENT_LOOP=LIBEV;CI_SCHEDULE_PYTHON_VERSION=3.7.7 3.8.3;CI_SCHEDULE_SERVER_VERSION=2.2 3.11 dse-5.1.35 dse-6.0.18 dse-6.7.17
654625
""" : "")
655626
}
656627

README.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,10 @@ Contributing
6666
------------
6767
See `CONTRIBUTING <https://github.com/scylladb/python-driver/blob/master/CONTRIBUTING.rst>`_.
6868

69+
Error Handling
70+
------------
71+
While originally written for the Java driver, users may reference the `Cassandra error handling done right blog <https://www.datastax.com/blog/cassandra-error-handling-done-right>`_ for resolving error handling scenarios with Apache Cassandra.
72+
6973
Reporting Problems
7074
------------------
7175
Please report any bugs and make any feature requests by clicking the New Issue button in

cassandra/__init__.py

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

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

26-
__version_info__ = (3, 27, 0)
26+
__version_info__ = (3, 28, 0)
2727
__version__ = '.'.join(map(str, __version_info__))
2828

2929

cassandra/cluster.py

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1017,7 +1017,7 @@ def default_retry_policy(self, policy):
10171017
cloud = None
10181018
"""
10191019
A dict of the cloud configuration. Example::
1020-
1020+
10211021
{
10221022
# path to the secure connect bundle
10231023
'secure_connect_bundle': '/path/to/secure-connect-dbname.zip',
@@ -1531,7 +1531,7 @@ def __init__(self, street, zipcode):
15311531
# results will include Address instances
15321532
results = session.execute("SELECT * FROM users")
15331533
row = results[0]
1534-
print row.id, row.location.street, row.location.zipcode
1534+
print(row.id, row.location.street, row.location.zipcode)
15351535
15361536
"""
15371537
if self.protocol_version < 3:
@@ -2656,12 +2656,6 @@ def __init__(self, cluster, hosts, keyspace=None):
26562656

26572657
self.encoder = Encoder()
26582658

2659-
if self.cluster.column_encryption_policy is not None:
2660-
try:
2661-
self.client_protocol_handler.column_encryption_policy = self.cluster.column_encryption_policy
2662-
except AttributeError:
2663-
log.info("Unable to set column encryption policy for session")
2664-
26652659
# create connection pools in parallel
26662660
self._initial_connect_futures = set()
26672661
for host in hosts:
@@ -2682,6 +2676,15 @@ def __init__(self, cluster, hosts, keyspace=None):
26822676
self.session_id = uuid.uuid4()
26832677
self._graph_paging_available = self._check_graph_paging_available()
26842678

2679+
if self.cluster.column_encryption_policy is not None:
2680+
try:
2681+
self.client_protocol_handler = type(
2682+
str(self.session_id) + "-ProtocolHandler",
2683+
(ProtocolHandler,),
2684+
{"column_encryption_policy": self.cluster.column_encryption_policy})
2685+
except AttributeError:
2686+
log.info("Unable to set column encryption policy for session")
2687+
26852688
if self.cluster.monitor_reporting_enabled:
26862689
cc_host = self.cluster.get_control_connection_host()
26872690
valid_insights_version = (cc_host and version_supports_insights(cc_host.dse_version))

0 commit comments

Comments
 (0)