On Jan 12, 2012, at 11:18 AM, Dale Bertrand wrote:

> 
> I'm building a simple app that writes form records to a database and
> displays them on a webpage.  I'm using webpy 0.36, Elixir-7.1,
> SQLAlchemy-6.4, MySQL 5.0.92.
> 
> The problem is that my app is reading a bogus number of records from
> the database.  In fact, immediately after I create a new record, if I
> repeatedly reload my list of records page, the number of records
> displayed will hop around until finally the correct number of records
> is displayed.
> 
> After about 30-60 seconds the correct number of records will be
> displayed on the page.

This sounds like you have some kind of caching layer in place which is 
displaying stale data.   SQLAlchemy itself doesn't really "cache" data except 
to the degree that data is local to a Session and corresponding transaction 
until commit() is called, or if you've installed a caching layer within it.

> The following line of code returns the wrong number of records for a
> short while after creating a new record:
> 
> campaigns =
> Campaign.query.filter_by(webinar_id=id).order_by('campaigns.created_at
> desc').all()

This suggests a recipe similar to Beaker caching is in use.  This isn't present 
in SQLAlchemy by default, there would be code within your application enabling 
this behavior.

http://www.sqlalchemy.org/docs/orm/examples.html#beaker-caching

-- 
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