I'm getting this error trying to map Select objects. Here's a test case: from sqlalchemy import *
e = create_engine('sqlite:///:memory:', echo=True) md = BoundMetaData(e) sql = """ CREATE TABLE books ( id integer PRIMARY KEY, -- auto-SERIAL in sqlite title text NOT NULL, published_year char(4) NOT NULL, authors text NOT NULL ) """ e.execute(sql) b = Table('books', md, autoload=True) s = select(["published_year", "count(*) as n"], from_obj=[b], group_by=[b.c.published_year]) s = s.alias('years_with_count') class YearWithCount(object): pass mapper = mapper(YearWithCount, s) session = create_session() q = session.query(YearWithCount) q.select_by(published_year='2006') # sqlalchemy.exceptions.AssertionError: Select statement should not be in its own _froms list -- Jonathan Ellis http://spyced.blogspot.com --~--~---------~--~----~------------~-------~--~----~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sqlalchemy -~----------~----~----~----~------~----~------~--~---