> Forgive the dumb question, but what is the proper SQLAlchemy
> recommended way to deal with a situation like this.
> Should I see if the object already exists first, or be lazy and try to
> write to the database and attempt to catch the exception.

Good question. Personally I think that this "Exception" is common
enough that you should check for it rather than catch it.

But if you stick with what you have, I believe you will catch the
error by adding something like this in your try statement:

session.save(u)
session.flush()

> I love to read, so if you can point me to some examples on situations
> like this it would be very helpful.

Not sure if this is what you mean, but here is a very good SA
tutorial:

http://www.rmunn.com/sqlalchemy-tutorial/tutorial.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
-~----------~----~----~----~------~----~------~--~---

Reply via email to