> -----Original Message-----
> From: sqlalchemy@googlegroups.com 
> [mailto:sqlalch...@googlegroups.com] On Behalf Of Mike Driscoll
> Sent: 04 February 2010 03:34
> To: sqlalchemy
> Subject: [sqlalchemy] Another tutorial!
> 
> Hi,
> 
> I just finished up a tutorial series on SqlAlchemy that I thought I'd
> share:
> 
> http://www.blog.pythonlibrary.org/2010/02/03/another-step-by-s
> tep-sqlalchemy-tutorial-part-1-of-2/
> http://www.blog.pythonlibrary.org/2010/02/03/another-step-by-s
> tep-sqlalchemy-tutorial-part-2-of-2/
> 
> Hopefully it's made well enough that people can follow the tutorial
> easily. Let me know if I made any serious blunders.
> 
> Thanks,
> 
> Mike
> 

Hi Mike,

Not a serious blunder, but I think there may be a small mistake in part
2, where you describe updating an email address:

  # change the first address
  prof.addresses[0] = Address("pr...@marvel.com")

I don't think this is going to update the 'pr...@dc.com' row in the
database to say 'pr...@marvel.com'. Instead, it is going to disconnect
that row from the user by setting the user_id to NULL, and add a new row
with the new address. (This may be what you intended, but I don't think
it's clear from the description).

I would have thought that you'd actually want to write this:

  # change the first address
  prof.addresses[0].email_address = "pr...@marvel.com"

Hope that helps,

Simon

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalch...@googlegroups.com.
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en.

Reply via email to