for this example, you need to define your mapper like this: max_mapper = mapper( MaxRevision, mapper_sel, primary_key = [ mapper_sel.c.name ]) which has two things. first of all, the primary key columns must be relative to the actual selectable which the mapper is defined from...once you map against a select statement, the underlying table is arbitrary...it could be composed of multiple tables, for example. the other thing is that a mapped class needs a primary mapper defined first. While you can only define one primary mapper per class (which actually is per class/per entity name), you can define any number of primary mappers against a particular table or selectable...so in this case as it seems MaxRevision is just a particular view object, theres no issue creating a primary mapper for it. On Sep 27, 2006, at 9:42 AM, Nikola Vukovljak wrote:
|
------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys -- and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________ Sqlalchemy-users mailing list Sqlalchemy-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users