Get dict instead of OrderedMapSerializedKey when reading Cassandra with Python

Viewed 273

I am trying to read a row from a Cassandra table in Python. This table has a map<text, some_object> field where some_object is a user defined type. This type then further has a map<text, text> for example in it, etc...

The problem is, when I read a row from such a table, every map field is read into a OrderedMapSerializedKey type object, and I need it to be a dict for proper JSON serialization afterwards.

Can I somehow tell the Python driver for Cassandra to read it as dict in the first place? If not, what would be an alternative solution? I know I can transform the OrderedMapSerializedKey field to dict myself (as I found here), but as I mentioned, the whole row can be a complicated nested structure with many maps within, so this is not a viable solution.

0 Answers
Related