zzzeek / sqla_issue_test

1 stars 0 forks source link

composite types #211

Closed zzzeek closed 6 years ago

zzzeek commented 18 years ago

Originally reported by: Michael Bayer (Bitbucket: zzzeek, GitHub: zzzeek)


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.


zzzeek commented 10 years ago

Original comment by Michael Bayer (Bitbucket: zzzeek, GitHub: zzzeek):


Removing milestone: 0.4.0 (automated comment)

zzzeek commented 17 years ago

Original comment by Michael Bayer (Bitbucket: zzzeek, GitHub: zzzeek):


rudimental functionality in changeset:2829.

zzzeek commented 17 years ago

Original comment by Michael Bayer (Bitbucket: zzzeek, GitHub: zzzeek):


i think this is an important feature, analgous to hibernate's "" mapping.