CherryPy + Database questions

Diez B. Roggisch deets at nospam.web.de
Mon Mar 5 08:44:05 EST 2007


Brian Blais wrote:

> Hello,
> 
> I have more of a conceptual question about the way databases work, in a
> web
> framework, but I will be implementing things with CherryPy and SQLAlchemy.
>  If you make a web form that adds rows to a database, and use sqlite as
> the engine, is there a danger of a race condition if several users at the
> same time try to submit the
> form?  I want a unique row id, and make a unique identifier for the
> submissions.  Am I in danger of having multiple submissions given the same
> identifier?
> 
> I know that if I implemented things without a database, but used a flat
> file or something like it, I would have that possibility, when two
> processes try to read and update the file at the same time.
> 
> If you want something more specific, I can throw some code together, but I
> wanted to get an answer before that because it will change the way I
> develop the code.

Usually, that is exactly what a RDBMS gives you. See the database connector
module's threadsaftey property to see what exactly you can expect.

Diez



More information about the Python-list mailing list