Value quoting is wrong when doing INSERT

Description

diff --git a/cassandra/cqlengine/usertype.py b/cassandra/cqlengine/usertype.py
index 1e30fc8..f55b512 100644
— a/cassandra/cqlengine/usertype.py
+++ b/cassandra/cqlengine/usertype.py
@@ -56,7 +56,7 @@ class BaseUserType(object):
return not self._eq_(other)

def _str_(self):

  • return "{}".format(', '.join("'{}': {}".format(k, getattr(self, k)) for k, v in six.iteritems(self._values)))
    + return "{}".format(', '.join("{}: '{}'".format(k, getattr(self, k)) for k, v in six.iteritems(self._values)))


def has_changed_fields(self):
return any(v.changed for v in self._values.values())

Possible fix is in ^. It should probably be different though based on the underlying type?

Environment

None

Pull Requests

None

Activity

Show:
Adam Holmberg
May 12, 2015, 2:28 PM

Unclear if there is an error, or if this is just a suggestion to make the instance str output look like CQL Trying to get further input.

Adam Holmberg
May 13, 2015, 1:25 PM

User shared the model that causes this error:

The problem is with cqlengine collections. They do not properly encode nested types. Will need to improve how encoding is done at that level.

Adam Holmberg
May 13, 2015, 8:12 PM
Michael Penick
May 15, 2015, 8:37 PM

+1 on the changes

Greg Bestland
May 26, 2015, 7:04 PM

Pull request for test submitted here.

https://github.com/datastax/python-driver/pull/331

Fixed

Assignee

Kishan Karunaratne

Reporter

Endre Karlson

Fix versions

Labels

Reproduced in

None

PM Priority

None

External issue ID

None

Doc Impact

None

Reviewer

None

Size

None

Pull Request

None

Affects versions

Priority

Major
Configure