make DCT return typestring with aliases included

PYTHON-579
This commit is contained in:
Adam Holmberg
2016-07-19 14:07:48 -05:00
parent f0cfc69378
commit f55c004871

View File

@@ -988,6 +988,14 @@ class CompositeType(_ParameterizedType):
class DynamicCompositeType(CompositeType):
typename = "org.apache.cassandra.db.marshal.DynamicCompositeType"
@classmethod
def cass_parameterized_type_with(cls, subtypes, full=False, **kwargs):
if not full: # short-circuit for unparsed type
return super(DynamicCompositeType, cls).cass_parameterized_type_with(subtypes)
# DCT is always formatted "full", and will always have subtypes (otherwise it is normalized to CompositeType by the server)
sublist = ', '.join('%s=>%s' % (alias, typ.cass_parameterized_type(full=True)) for alias, typ in zip(cls.fieldnames, subtypes))
return '%s(%s)' % (cls.typename, sublist)
class ColumnToCollectionType(_ParameterizedType):
"""