composite types
Issue #211
resolved
heres one way this could work at just the mapper level:
class Point(object):
def __init__(self, x, y):
self.x = x
self.y = y
def __colset__(self):
return [self.y](self.x,)
mapper(class, table, properties={
'vertex':composite(table.c.xpos, table.c.ypos, Point)
}
)
the composite
function would resolve to CompositeProperty
. the columns in the row would translate to Point(col1, col2)
and instances of the Point
class would be translated back via __colset__
(or something like that).
should composite types be available at the table level ? probably not since Tables are supposed to act like database tables.
Comments (3)
-
reporter -
reporter - changed status to resolved
rudimental functionality in changeset:2829.
-
reporter - removed milestone
Removing milestone: 0.4.0 (automated comment)
- Log in to comment
i think this is an important feature, analgous to hibernate's "<component>" mapping.