Hi. I have some (very simple) tables defined in my model, such as extensions = Table('ast_user_extension', metadata, Column("id", Integer, autoincrement=True, primary_key=True), Column("extension", Unicode(20), nullable=False), Column("name", Unicode(50), nullable=False), Column("start_date", DateTime, nullable=False), Column("end_date", DateTime), Column("user_id", Unicode(3), ForeignKey('user.id')), Column("group_area", Unicode(100)), Column("group_country_id", Unicode(3)), CheckConstraint("end_date is null or end_date>=start_date", name="ast_usr_ext_ck1"), ForeignKeyConstraint(("group_area", "group_country_id"), ("group.area", "group.country_id"), 'group_fk'), useexisting=True)
The thing is that when I'm working with the model in the interactive console (ipython) and I try to reload the module I'm getting KeyError: ForeignKeyConstraint() and so I need to exit ipython and log in again. It's not a critical problem but it's a bit cumbersome. What can I do to fix it? Find below the full error stack. TIA, Mariano /home/mariano/Code/ReportingCom/asterisk/repdotcom/repdotcom/model/asterisk.py in <module>( ) 28 ("group.area", "group.country_id"), 29 'group_fk'), ---> 30 useexisting=True) 31 Index("ast_usr_ext_ix", *(extensions.c.extension, extensions.c.name)) 32 Index("ast_usr_ext_gro_ix", *(extensions.c.group_area, /home/mariano/Sandbox/reporting/lib/python2.6/site-packages/SQLAlchemy-0.6.2-py2.6.egg/sqla lchemy/schema.pyc in __new__(cls, *args, **kw) 197 "columns on an existing Table object." % key) 198 table = metadata.tables[key] --> 199 table._init_existing(*args, **kw) 200 return table 201 else: /home/mariano/Sandbox/reporting/lib/python2.6/site-packages/SQLAlchemy-0.6.2-py2.6.egg/sqla lchemy/schema.pyc in _init_existing(self, *args, **kwargs) 288 289 self._extra_kwargs(**kwargs) --> 290 self._init_items(*args) 291 292 def _extra_kwargs(self, **kwargs): /home/mariano/Sandbox/reporting/lib/python2.6/site-packages/SQLAlchemy-0.6.2-py2.6.egg/sqla lchemy/schema.pyc in _init_items(self, *args) 57 for item in args: 58 if item is not None: ---> 59 item._set_parent(self) 60 61 def _set_parent(self, parent): /home/mariano/Sandbox/reporting/lib/python2.6/site-packages/SQLAlchemy-0.6.2-py2.6.egg/sqla lchemy/schema.pyc in _set_parent(self, table) 792 col.foreign_keys.remove(fk) 793 table.foreign_keys.remove(fk) --> 794 table.constraints.remove(fk.constraint) 795 796 table._columns.replace(self) KeyError: ForeignKeyConstraint() -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to sqlalch...@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.