[sqlalchemy] Re: Relation w/ declarative

2009-08-06 Thread Wichert Akkerman
On 8/6/09 09:30 , werner wrote: IIRC correctly the __init__ section is only needed if you want to do: add = Address('an email address') I never do this, i.e. I assign like this add = Address() add.email_address = 'an email address' You can also do this with the default declarative base

[sqlalchemy] Re: Relation w/ declarative

2009-08-06 Thread allen.fowler
On Aug 6, 3:30 am, werner wbru...@free.fr wrote: I never do this, i.e. I assign like this add = Address() add.email_address = 'an email address' In what way is the Address object expected to be instantiated such that it receives the correct user id? You just do this and SA will take

[sqlalchemy] Re: Relation w/ declarative

2009-08-06 Thread allen.fowler
On Aug 6, 4:59 am, Wichert Akkerman wich...@wiggy.net wrote: On 8/6/09 09:30 , werner wrote: IIRC correctly the __init__ section is only needed if you want to do: add = Address('an email address') I never do this, i.e. I assign like this add = Address() add.email_address = 'an

[sqlalchemy] Re: Relation w/ declarative

2009-08-06 Thread werner
Allen, allen.fowler wrote: ... What is that __repr__ function doing exactly? Looks interesting. It is really useful, and yes Michael comes up with beauties like this. Produces nice print output, i.e.: print 'after flush' print con print add Will give you: after flush