Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…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)
  • Loading branch information
fruch committed Jun 6, 2024
2 parents c69935e + e3400a1 commit 8953796
Show file tree
Hide file tree
Showing 31 changed files with 718 additions and 437 deletions.
22 changes: 22 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,25 @@
3.28.0
======
June 5, 2023

Features
--------
* Add support for vector type (PYTHON-1352)
* Cryptography module is now an optional dependency (PYTHON-1351)

Bug Fixes
---------
* Store IV along with encrypted text when using column-level encryption (PYTHON-1350)
* Create session-specific protocol handlers to contain session-specific CLE policies (PYTHON-1356)

Others
------
* Use Cython for smoke builds (PYTHON-1343)
* Don't fail when inserting UDTs with prepared queries with some missing fields (PR 1151)
* Convert print statement to function in docs (PR 1157)
* Update comment for retry policy (DOC-3278)
* Added error handling blog reference (DOC-2813)

3.27.0
======
May 1, 2023
Expand Down
95 changes: 33 additions & 62 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@ Test Profiles:
Matrix Types:
Full: All server versions, python runtimes tested with and without Cython.
Develop: Smaller matrix for dev purpose.
Cassandra: All cassandra server versions.
Dse: All dse server versions.
Smoke: CI-friendly configurations. Currently-supported Python version + modern Cassandra/DSE instances.
We also avoid cython since it's tested as part of the nightlies
Parameters:
Expand All @@ -29,35 +30,30 @@ import com.datastax.jenkins.drivers.python.Slack

slack = new Slack()

// Define our predefined matrices
//
// Smoke tests are CI-friendly test configuration. Currently-supported Python version + modern C*/DSE instances.
// We also avoid cython since it's tested as part of the nightlies.
DEFAULT_CASSANDRA = ['2.1', '2.2', '3.0', '3.11', '4.0']
DEFAULT_DSE = ['dse-5.0.15', 'dse-5.1.35', 'dse-6.0.18', 'dse-6.7.17', 'dse-6.8.30']
DEFAULT_RUNTIME = ['3.7.7', '3.8.3']
DEFAULT_CYTHON = ["True", "False"]
matrices = [
"FULL": [
"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'],
"RUNTIME": ['2.7.18', '3.5.9', '3.6.10', '3.7.7', '3.8.3'],
"CYTHON": ["True", "False"]
],
"DEVELOP": [
"SERVER": ['2.1', '3.11', 'dse-6.8.30'],
"RUNTIME": ['2.7.18', '3.6.10'],
"CYTHON": ["True", "False"]
"SERVER": DEFAULT_CASSANDRA + DEFAULT_DSE,
"RUNTIME": DEFAULT_RUNTIME,
"CYTHON": DEFAULT_CYTHON
],
"CASSANDRA": [
"SERVER": ['2.1', '2.2', '3.0', '3.11', '4.0'],
"RUNTIME": ['2.7.18', '3.5.9', '3.6.10', '3.7.7', '3.8.3'],
"CYTHON": ["True", "False"]
"SERVER": DEFAULT_CASSANDRA,
"RUNTIME": DEFAULT_RUNTIME,
"CYTHON": DEFAULT_CYTHON
],
"DSE": [
"SERVER": ['dse-5.0.15', 'dse-5.1.35', 'dse-6.0.18', 'dse-6.7.17', 'dse-6.8.30'],
"RUNTIME": ['2.7.18', '3.5.9', '3.6.10', '3.7.7', '3.8.3'],
"CYTHON": ["True", "False"]
"SERVER": DEFAULT_DSE,
"RUNTIME": DEFAULT_RUNTIME,
"CYTHON": DEFAULT_CYTHON
],
"SMOKE": [
"SERVER": ['3.11', '4.0', 'dse-6.8.30'],
"RUNTIME": ['3.7.7', '3.8.3'],
"CYTHON": ["True", "False"]
"SERVER": DEFAULT_CASSANDRA.takeRight(2) + DEFAULT_DSE.takeRight(1),
"RUNTIME": DEFAULT_RUNTIME.takeRight(2),
"CYTHON": ["True"]
]
]

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

def profile = "${params.PROFILE}"
def PROFILE = "${params.PROFILE}"
def EVENT_LOOP = "${params.EVENT_LOOP.toLowerCase()}"
matrixType = "SMOKE"
developBranchPattern = ~"((dev|long)-)?python-.*"

if (developBranchPattern.matcher(env.BRANCH_NAME).matches()) {
matrixType = "DEVELOP"
if (env.BRANCH_NAME.contains("long")) {
profile = "FULL"
}
}
matrixType = params.MATRIX != "DEFAULT" ? params.MATRIX : "SMOKE"
matrix = matrices[matrixType].clone()

// Check if parameters were set explicitly
if (params.MATRIX != "DEFAULT") {
matrixType = params.MATRIX
}

matrix = matrices[matrixType].clone()
if (params.CYTHON != "DEFAULT") {
matrix["CYTHON"] = [params.CYTHON]
}
Expand All @@ -121,7 +106,7 @@ def getBuildContext() {

context = [
vars: [
"PROFILE=${profile}",
"PROFILE=${PROFILE}",
"EVENT_LOOP=${EVENT_LOOP}"
],
matrix: matrix
Expand Down Expand Up @@ -401,8 +386,9 @@ def describeBuild(buildContext) {
}
}

def scheduleTriggerJobName() {
"drivers/python/oss/master/disabled"
// branch pattern for cron
def branchPatternCron() {
~"(master)"
}

pipeline {
Expand Down Expand Up @@ -467,7 +453,7 @@ pipeline {
</table>''')
choice(
name: 'MATRIX',
choices: ['DEFAULT', 'SMOKE', 'FULL', 'DEVELOP', 'CASSANDRA', 'DSE'],
choices: ['DEFAULT', 'SMOKE', 'FULL', 'CASSANDRA', 'DSE'],
description: '''<p>The matrix for the build.</p>
<table style="width:100%">
<col width="25%">
Expand All @@ -488,10 +474,6 @@ pipeline {
<td><strong>FULL</strong></td>
<td>All server versions, python runtimes tested with and without Cython.</td>
</tr>
<tr>
<td><strong>DEVELOP</strong></td>
<td>Smaller matrix for dev purpose.</td>
</tr>
<tr>
<td><strong>CASSANDRA</strong></td>
<td>All cassandra server versions.</td>
Expand All @@ -503,22 +485,11 @@ pipeline {
</table>''')
choice(
name: 'PYTHON_VERSION',
choices: ['DEFAULT', '2.7.18', '3.5.9', '3.6.10', '3.7.7', '3.8.3'],
choices: ['DEFAULT'] + DEFAULT_RUNTIME,
description: 'Python runtime version. Default to the build context.')
choice(
name: 'SERVER_VERSION',
choices: ['DEFAULT',
'2.1', // Legacy Apache CassandraⓇ
'2.2', // Legacy Apache CassandraⓇ
'3.0', // Previous Apache CassandraⓇ
'3.11', // Current Apache CassandraⓇ
'4.0', // Development Apache CassandraⓇ
'dse-5.0.15', // Long Term Support DataStax Enterprise
'dse-5.1.35', // Legacy DataStax Enterprise
'dse-6.0.18', // Previous DataStax Enterprise
'dse-6.7.17', // Previous DataStax Enterprise
'dse-6.8.30', // Current DataStax Enterprise
],
choices: ['DEFAULT'] + DEFAULT_CASSANDRA + DEFAULT_DSE,
description: '''Apache CassandraⓇ and DataStax Enterprise server version to use for adhoc <b>BUILD-AND-EXECUTE-TESTS</b> <strong>ONLY!</strong>
<table style="width:100%">
<col width="15%">
Expand Down Expand Up @@ -549,7 +520,7 @@ pipeline {
</tr>
<tr>
<td><strong>4.0</strong></td>
<td>Apache CassandraⓇ v4.x (<b>CURRENTLY UNDER DEVELOPMENT</b>)</td>
<td>Apache CassandraⓇ v4.0.x</td>
</tr>
<tr>
<td><strong>dse-5.0.15</strong></td>
Expand All @@ -574,7 +545,7 @@ pipeline {
</table>''')
choice(
name: 'CYTHON',
choices: ['DEFAULT', 'True', 'False'],
choices: ['DEFAULT'] + DEFAULT_CYTHON,
description: '''<p>Flag to determine if Cython should be enabled</p>
<table style="width:100%">
<col width="25%">
Expand Down Expand Up @@ -647,10 +618,10 @@ pipeline {
}

triggers {
parameterizedCron((scheduleTriggerJobName() == env.JOB_NAME) ? """
parameterizedCron(branchPatternCron().matcher(env.BRANCH_NAME).matches() ? """
# Every weeknight (Monday - Friday) around 4:00 AM
# These schedules will run with and without Cython enabled for Python v2.7.18 and v3.5.9
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
# These schedules will run with and without Cython enabled for Python 3.7.7 and 3.8.3
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
""" : "")
}

Expand Down
4 changes: 4 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,10 @@ Contributing
------------
See `CONTRIBUTING <https://github.com/scylladb/python-driver/blob/master/CONTRIBUTING.rst>`_.

Error Handling
------------
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.

Reporting Problems
------------------
Please report any bugs and make any feature requests by clicking the New Issue button in
Expand Down
2 changes: 1 addition & 1 deletion cassandra/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def emit(self, record):

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

__version_info__ = (3, 27, 0)
__version_info__ = (3, 28, 0)
__version__ = '.'.join(map(str, __version_info__))


Expand Down
19 changes: 11 additions & 8 deletions cassandra/cluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -1017,7 +1017,7 @@ def default_retry_policy(self, policy):
cloud = None
"""
A dict of the cloud configuration. Example::
{
# path to the secure connect bundle
'secure_connect_bundle': '/path/to/secure-connect-dbname.zip',
Expand Down Expand Up @@ -1531,7 +1531,7 @@ def __init__(self, street, zipcode):
# results will include Address instances
results = session.execute("SELECT * FROM users")
row = results[0]
print row.id, row.location.street, row.location.zipcode
print(row.id, row.location.street, row.location.zipcode)
"""
if self.protocol_version < 3:
Expand Down Expand Up @@ -2656,12 +2656,6 @@ def __init__(self, cluster, hosts, keyspace=None):

self.encoder = Encoder()

if self.cluster.column_encryption_policy is not None:
try:
self.client_protocol_handler.column_encryption_policy = self.cluster.column_encryption_policy
except AttributeError:
log.info("Unable to set column encryption policy for session")

# create connection pools in parallel
self._initial_connect_futures = set()
for host in hosts:
Expand All @@ -2682,6 +2676,15 @@ def __init__(self, cluster, hosts, keyspace=None):
self.session_id = uuid.uuid4()
self._graph_paging_available = self._check_graph_paging_available()

if self.cluster.column_encryption_policy is not None:
try:
self.client_protocol_handler = type(
str(self.session_id) + "-ProtocolHandler",
(ProtocolHandler,),
{"column_encryption_policy": self.cluster.column_encryption_policy})
except AttributeError:
log.info("Unable to set column encryption policy for session")

if self.cluster.monitor_reporting_enabled:
cc_host = self.cluster.get_control_connection_host()
valid_insights_version = (cc_host and version_supports_insights(cc_host.dse_version))
Expand Down
Loading

0 comments on commit 8953796

Please sign in to comment.