[sqlalchemy] Re: sqlalchemy.exc.NoReferencedTableError: Could not find table with which to generate a foreign key

2011-03-30 Thread eric cire
Hi, i can actually confirm that i don't get the error when all models are in the same module. Any ideas? On Wed, Mar 30, 2011 at 3:57 PM, eric cire 371c@gmail.com wrote: After investigating further, i have the impression that the problem occurs when models are in different modules

RE: [sqlalchemy] Re: sqlalchemy.exc.NoReferencedTableError: Could not find table with which to generate a foreign key

2011-03-30 Thread King Simon-NFHD78
This is just the way Python works - code inside a module is only executed when that module is imported. If you don't import myapp.models.notes, then the class definitions never get executed. One solution is to import all the sub-modules in your bootstrap.py before calling create_all. Another is

[sqlalchemy] Re: sqlalchemy.exc.NoReferencedTableError: Could not find table with which to generate a foreign key

2011-03-30 Thread 371c
Actually that helps alot and i had infact resolved to and was in the process of doing so (i know that about python modules.. ;) but i might be missing something) But, why does this work in the context of an application (eg. pylons app). Basically, calling Base.create_all() in some init_db

[sqlalchemy] Re: sqlalchemy.exc.NoReferencedTableError: Could not find table with which to generate a foreign key

2011-03-30 Thread 371c
Actually that helps alot and i had infact resolved to and was in the process of doing so (i know that about python modules.. ;) but i might be missing something) But, why does this work in the context of an application (eg. pylons app). Basically, calling Base.create_all() in some init_db

RE: [sqlalchemy] Re: sqlalchemy.exc.NoReferencedTableError: Could not find table with which to generate a foreign key

2011-03-30 Thread King Simon-NFHD78
Something else must be importing those modules when run from pylons. If you really want to know how they are getting imported, stick something in the module which will raise an exception when it is imported (eg type blah blah blah at the top of the module) and look at the traceback. Cheers,