I am running SQLAlchemy under a multithreaded python server (paster),
as part of a web application which is written using the Python Pyramid
framework.  When I modify an existing database entry through SQL
alchemy, subsequent page refreshes seem to randomly pick between the
original instance of the object, and the modified copy.

For example: if I have user object where user.username is "jdoe", and
I change the username to "rickymartin", and then keep refreshing the
page, I will randomly see the "jdoe" and "rickymartin", as the
username.  If I then change the username again to "shakira", and
continue to refresh the page, I will randomly see "shakira" or
"rickymartin".  If I check the database independently, or if I restart
the web server, I will only ever see updated version of the username.

I am using a single scoped_session instance to create the sessions,
which is global to all the threads running in the web application.  I
can solve this issue by creating a new session every time a request
comes in, but that would make the code a bit sloppy and I'm trying to
avoid doing that.  I'm using a "NullPool" connection to the database
engine, by the way, just in case that would change anything.

My two thoughts are that this is some sort of threading issue (due to
the non-determinism), or cacheing issue.  However - according to my
incomplete understanding of the SQLAlchemy documentation, SQLAlchemy
doesn't seem to cache results.  Any ideas on how to debug / solve
this.

I am using:
SQLAlchemy (version 0.7.5)
SQlite3 database backend
Python Pyramid (version 1.3a7)
Python (version 2.6.6)

-- 
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 
sqlalchemy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en.

Reply via email to