fixed in r3867. your code below will still raise an exception, just a more decriptive one.
On Dec 7, 2007, at 6:35 AM, Andrew Stromnov wrote: > > persons_table = Table(u'persons', dbconfig.metadata, > Column(u'person_id', Integer(20), primary_key=True, > autoincrement=True, nullable=False, default=0), > Column(u'level', Integer(11), nullable=False, default=1), > autoload = False) > > class Person(object): > pass > > mapper(Person, persons_table) > > stat_by_level = select([Person.level, > func.count(Person.level).label('count')], > order_by=[Person.level], > group_by=[Person.level]).alias('stats') > > class StatByLevel(object): > pass > > mapper(StatByLevel, stat_by_level) > > > desktop:~/Projects/test$ python model.py > Traceback (most recent call last): > File "model.py", line 58, in <module> > mapper(StatByLevel, stat_by_level) > File "/usr/lib/python2.5/site-packages/SQLAlchemy-0.4.2dev_r3866- > py2.5.egg/sqlalchemy/orm/__init__.py", line 518, in mapper > return Mapper(class_, local_table, *args, **params) > File "/usr/lib/python2.5/site-packages/SQLAlchemy-0.4.2dev_r3866- > py2.5.egg/sqlalchemy/orm/mapper.py", line 153, in __init__ > self._compile_pks() > File "/usr/lib/python2.5/site-packages/SQLAlchemy-0.4.2dev_r3866- > py2.5.egg/sqlalchemy/orm/mapper.py", line 421, in _compile_pks > if len(self._pks_by_table[self.mapped_table]) == 0: > KeyError: <sqlalchemy.sql.expression.Alias object at 0x842c98c> > > > --~--~---------~--~----~------------~-------~--~----~ 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?hl=en -~----------~----~----~----~------~----~------~--~---