On Aug 7, 2006, at 11:19 AM, Bill Noon wrote: > user_map = mapper(User, users) > s = select([users.c.user_id, > func.max(users.c.timestamp).label('timestamp'), users.c.name]) > user1_map = mapper(User, s.alias('t'), non_primary = True) > > session = create_session() > q = session.query(user1_map) > q.select(users.c.user_id == 1) >
yeah, when you map to the selectable, the selectable becomes the thing that its based on. so, it would look like this: s = select(...) t = s.alias('t') user1_map = mapper(User, t, non_primary=True) q = session.query(user1_map) q.select(t.c.user_id==1) in the other case, its seeing "t" and "users" and its trying to join them together. you can also use select_by which is based on keyword arguments to insulate from this phenomenon a little bit.... ------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 _______________________________________________ Sqlalchemy-users mailing list Sqlalchemy-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users