Hello, I am using SQLAlchemy in a Pylons project and I like it.
However I am questioning about the best way to insert data into a database. I have a User class mapping my user table which has a Column 'username' which has a unique constraint. So I have a form to add a new user when I submit the form I query the database to see if the 'username' is already being used. I think the way I'm doing it is not good in the case where I have two people trying to add the same 'username' at the same time, I guess the both queries will return an empty set then when comitting the sessions one will go well and one will fail returning a 503 error to the user. So I would like instead of doing this try to flush the session and catch the exception if any and find the error. I don't know which method is the best or if one method is wrong furthermore I don't know enough about database systems and if they all react the same way. Thanks for anyone who could give me more information about this. -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to [email protected]. 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.
