Unable to import model using UserType without setuping connection since 3.7

Description

Hello,

Since Cassandra 3.7 I cannot import anymore a model using UserType without having initialized first a connection:

Problem comes from this code:

In ModelMetaClass._new_ (cassandra/cqlengine/models.py).

I don't think you can expect having a fully setup connection when import a class inheriting from base model class.

I found at least one other person complaining from the same issue:
http://stackoverflow.com/questions/39720240/cql-engine-exception-about-a-connection-name-not-existing-in-registry

PS: It used to work before upgrading to 3.7.

Best regards, Adam.

Environment

None

Pull Requests

None

Activity

Show:
Jim Witschey
November 16, 2016, 7:04 AM

Ah, yep. So one way to avoid breaking the register_for_keyspace API would be to add that to the UDT-registration code in ModelMetaClass._new_?

Is that behavior – registering a UDT to all registered connections on UDT class definition – what we want?

Alan Boudreault
November 17, 2016, 1:15 AM

I am wondering if we could simply re-apply the checks we had before this new feature. IIRC, only 1 or 2 management functions had this connection check. Am I right?

Jim Witschey
November 30, 2016, 9:55 AM

Ready for further review. Commit history needs some cleanup, but the dedupe we talked about should be gone. This may need more tests.

Jim Witschey
December 13, 2016, 7:24 AM

Documentation and a couple small code changes ready for final review.

Greg Bestland
December 22, 2016, 9:56 AM

Great Job, added some metadata docs to the integration tests, and some negative validation scenarios.

https://github.com/riptano/python-dse-driver/commit/234aa40b659cafa029505e95819b8eb0174475ed

Sending this to done.

Fixed

Assignee

Unassigned

Reporter

Cecile

Fix versions

Labels

Reproduced in

None

PM Priority

None

External issue ID

None

Doc Impact

None

Reviewer

None

Size

None

Pull Request

None

Sprint

Py P-NEXT

Affects versions

Priority

Major