CQL Nested structure selection with collections

23 views
Skip to first unread message

Charles-Antoine Dupont

unread,
May 17, 2016, 4:23:43 PM5/17/16
to DataStax Python Driver for Apache Cassandra User Mailing List
Hi,
From what I can see, nested structures like UDTs can be selected in CQL using the dot notation (e.g. "SELECT field.subfield").
Is there a way to select fields of a UDT within a collection(set/list/map) or do we need to select the entire collection and manually process the result?

e.g. 
if we have the field "addresses" which is a list of UDT "address",
which contains many fields, but 
we only want to get the subfield "city", in order to get a list of cities as a result.

ps. This use case could be solved differently, it's just to illustrate the structure type and how I wish to select it.

Thank you

Adam Holmberg

unread,
May 23, 2016, 1:47:23 PM5/23/16
to python-dr...@lists.datastax.com
Presently the mapper will only select the entire UDT value. There is no way to select a single subfield.

There is a pattern in the model query set that allows one to specify *only* certain columns, but that pattern was not extended into UDTs. If this is an important use case for you, I would welcome a ticket on the matter.

Since you mention other solutions already, I won't elaborate on the alternatives.

Regards,
Adam Holmberg



--
You received this message because you are subscribed to the Google Groups "DataStax Python Driver for Apache Cassandra User Mailing List" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python-driver-u...@lists.datastax.com.

Reply all
Reply to author
Forward
0 new messages