make sure everything that's needed is imported, and that you arent suppressing any exceptions which occur when the mappers first compile themselves. try calling compile_mappers() to force the issue.
On Apr 2, 8:19 pm, "phrrn...@googlemail.com" <phrrn...@googlemail.com> wrote: > This code works when executed within a if __name__ == '__main__' > block in the .py that contains the model: > > s = MySession(bind=e) > q = s.query(DatabaseTable).filter(DatabaseTable.TABLE_CAT=='credit') > for i in q: > print i > > However, if I take it out and put it in a separate file, I get an > error like this. I hope that this is something simple that I am doing > wrong? > pjjH > > Traceback (most recent call last): > File "H:\work\base_python\python\chimera_driver.py", line 14, in > <module> > for i in q: > File "C:\PROGRA~1\Python25\lib\site-packages\sqlalchemy-0.5.2- > py2.5.egg\sqlalchemy\orm\query.py", line 1276, in __iter__ > context = self._compile_context() > File "C:\PROGRA~1\Python25\lib\site-packages\sqlalchemy-0.5.2- > py2.5.egg\sqlalchemy\orm\query.py", line 1718, in _compile_context > entity.setup_context(self, context) > File "C:\PROGRA~1\Python25\lib\site-packages\sqlalchemy-0.5.2- > py2.5.egg\sqlalchemy\orm\query.py", line 1972, in setup_context > column_collection=context.primary_columns > File "C:\PROGRA~1\Python25\lib\site-packages\sqlalchemy-0.5.2- > py2.5.egg\sqlalchemy\orm\interfaces.py", line 580, in setup > self.__get_context_strategy(context, path + > (self.key,)).setup_query(context, entity, path, adapter, **kwargs) > File "C:\PROGRA~1\Python25\lib\site-packages\sqlalchemy-0.5.2- > py2.5.egg\sqlalchemy\orm\interfaces.py", line 566, in __get_context_ > strategy > return self.strategy > AttributeError: 'RelationProperty' object has no attribute 'strategy' --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---