Hier
ist das Stück Code, das komplexe Typen in cx_Oracle handhabt.
Auszug:
def ObjectRepr(obj):
if obj.type.iscollection:
returnValue = []
for value in obj.aslist():
if isinstance(value, cx_Oracle.Object):
value = ObjectRepr(value)
returnValue.append(value)
else:
returnValue = {}
for attr in obj.type.attributes:
value = getattr(obj, attr.name)
if value is None:
continue
elif isinstance(value, cx_Oracle.Object):
value = ObjectRepr(value)
returnValue[attr.name] = value
return returnValue
Sie verwenden es wie ObjectRepr(complex[0][0])
, falls len(complex)>0
, natürlich