Connection setup methods prevent using ExecutionProfile in cqlengine

Description

When using ExecutionProfile, any attempt to register or create a connection/session fails because some methods set attributes on session and this raises errors (from Session._validate_set_legacy_config), reason is that when you use ExecutionProfile you can't set attributes on Session objects, but this is made by cassandra-driver code, so it seems that it's rather impossible to use it.

I've tried many "escapes" and the code below is the last (dirty) attempt:

Result: ValueError raised:

In the code above, the ValueError is raised from Connection.from_session, but the same happens if you use register_connection, setup_connection or any other method related to the creation of a session/connection.

Am I missing anything?...

Environment

Linux Debian/Ubuntu

Pull Requests

None

Activity

Show:
D. Nappo
August 21, 2018, 11:01 PM

Hi Alan,
thanks for answering.

No, I've already tried. It calls the Connection.setup() method and it gives problems because this tries to set a property on session (default_consistency_level) which on turn calls the self._validate_set_legacy_config('default_consistency_level', cl)

This is the chain:

https://github.com/datastax/python-driver/blob/master/cassandra/cqlengine/connection.py#L194
https://github.com/datastax/python-driver/blob/master/cassandra/cqlengine/connection.py#L112
https://github.com/datastax/python-driver/blob/master/cassandra/cluster.py#L1960
https://github.com/datastax/python-driver/blob/master/cassandra/cluster.py#L2655

D. Nappo
August 21, 2018, 11:03 PM

I think the work around is basically to use legacy config options.

Yes, it's totally fine. Just wanted to try this feature and report the issue.
Thanks!

Alan Boudreault
August 21, 2018, 11:25 PM

Thanks for the report!

Jim Witschey
December 14, 2018, 1:52 AM

I think the goal here should be to make cqlengine compatible with both legacy and EP config until the next major: we can't break legacy config in a minor, and we should support EPs so that cqlengine users can transition to EPs for the next major.

, , do you agree?

If so, maybe we can alter some of the shorter cqlengine tests to run with both legacy and EP config. Seem like a plan?

Chris Splinter
December 14, 2018, 2:13 AM

Works for me.

Fixed

Assignee

James Falcon

Reporter

D. Nappo

Fix versions

Labels

Reproduced in

None

PM Priority

B

External issue ID

None

Doc Impact

None

Reviewer

None

Size

None

Pull Request

None

Sprint

Py P-NEXT

Affects versions

Priority

Major