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
Contact(address=
On Aug 6, 4:59 am, Wichert Akkerman 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 email add
On Aug 6, 3:30 am, werner 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 care of
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 bas
Hi,
AF wrote:
> Am starting to experiment with declarative base.
>
> In the code block at:
>
> http://www.sqlalchemy.org/docs/05/ormtutorial.html#building-a-relation
>
> Why does __init__() not contain any mention of the foreign key
> "user_id"?
>
>
As one normally does not manually set an id