What would be the recommended method of mapping something like a Money class - objects that are a basic value + descriptor where the descriptor (in this example currency) is more than just a primitive variable?
For example: class Currency(object): def __init__(self, code, descrip): self.code = code self.descrip = descrip class Money(object): def __init__(self, value, currency): self.value = value self.currency = currency class Product(object): def __init__(self, code, cost): self.code = code self.cost = cost My first thought was to apply a composite mapping to the Product table. If a money value was simply Money(10.00,'EUR') it is straightforword. However, I want the full use of a Currency object ( i.e. Money(10.00,Currency('EUR')) ). I also don't want to map a separate table (a many-to-many relation) just to record monetary values for a Product object. Is it possible to apply a foreign key within a composite mapping? Any suggestions would be helpful. Another example of these value + descriptor type objects would be weights and measures (e.g. 10lb, 20km, etc.). Thanks, Mark --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to sqlalchemy@googlegroups.com To unsubscribe from this group, send email to sqlalchemy+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~----------~----~----~----~------~----~------~--~---