On Jan 13, 2009, at 8:19 AM, Andreas Jung wrote:
> -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > Is it possible to define multiple mappers for one table? > > Usecase: I have one big table (60 cols) and one big mapper class. > For some reporting I don't need only a small number of cols. For > performance reasons I would like to load the related rows using a very > minimal mapper. However there is no obvious way to configure a > non-primary mapper using the declarative layer? declarative can't create non primary mappers (it would be a contradiction), but "non primary mapper" only applies to multiple mappers for a class, not for a table. any number of mappers of any kind can point to a single table. to map to any table just set the __table__ argument to the Table. if you already have another declarative class, youd say __table__ = MyOtherClass.__table__. however, the use case you mention doesn't need any of that multiple table confusion, you should just be using deferred columns. See the mapping documentation for details on that construct. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---