On Jul 14, 2008, at 11:02 AM, Heston James - Cold Beans wrote:
> > Hello Michael, > >> what I see immediately is that you're declaring mutliple >> declarative_bases and multiple MetaData objects. All of the Table >> objects which relate to one another need to share the same underlying >> MetaData object, and the declarative_base() function also uses a >> MetaData object which it creates for you, unless one is passed. >> >> So you need a "global" module everyone works from which starts with >> something like: >> >> meta = MetaData() >> Base = declarative_base(metadata=meta) >> >> then every Table uses the above "meta" as its "metadata" argument, >> every declared mapped class inherits from Base. > > Thank you kindly for this concept, I really appreciate your advice > thus far. > I'm still struggling with this same challenge though, I've got a > horrible > dose of n00bitus I'm afraid. > > Above you talk about a global module in the application which > creates the > Base and metadata, but I don't understand how these can then be > accessed by > other classes around the application? create a file called something like "globals.py", and in all other modules that use SQLAlchemy, say "import globals". A primer on modules, packages and such is at http://www.python.org/doc/tut/node8.html . --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---