On Jul 13, 2008, at 5:29 AM, Heston James - Cold Beans wrote:

>
> Hi Michael,
>
>> declarative places a convenience "__init__" that installs keywords as
>> attributes, but you're free to override this constructor with  
>> anything
>> you'd like.
>
> Thank you for confirming this for me, I'd hoped I'd be able to  
> override the
> class constructor, I often use it for considerably more than basic  
> property
> setting and it would be a shame if declarative had upset that.
>
> I'm still yet to solve this problem, don't have any ideas what I'm  
> doing
> wrong do you? Did you see the code examples I attached? Am I  
> approaching
> this in the correct manor?

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.

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