if i remember correct, your Base's has to be same one, else it won't 
work. do check on this - i may be wrong.

On Wednesday 12 November 2008 01:17:34 cropr wrote:
> I want to build a relation to a class located in a different file
>
> file user.py
> ---------------
> class Users(Base):
>     __tablename__ = 'users'
>     username = Column(types.String(32), primary_key=True)
>     password = Column(types.String(32))
>
> file content.py
> -------------------
> from user import Users
>
> class Content(Base):
>     __tablename__ = 'content'
>     id = Column(types.Integer, primary_key=True,
> autoincrement=True) title = Column(types.String(80))
>     createUser = Column(types.String(32),
> ForeignKey('users.username'))
>
> If I do
>   a = Content()
> I get thye following error
> NoReferencedTableError: Could not find table 'users' with which to
> generate a foreign key
> If I redo
>   a =Content()
> it works.
> Is this a bug, or do I something wrong
>
> I don't have this behaviour is I put the definition of Users in the
> content.py file
> 


--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to