it sounds like you are coming up against basic transaction isolation
behavior.   some background is available at
http://dev.mysql.com/doc/refman/5.1/en/innodb-transaction-model.html .

if you wanted to turn it off, you could use MyISAM tables or use your
session with autocommit=True.




Andrew wrote:
> Ok... looks like I was hasty. The problem still seems fixed so far -
> but my reasoning seems wrong.
> It looks like the authentication request is contained within the
> transaction - so I don't see why doing a select on a table within the
> authentication function would cause problems. However adding a
> session.rollback after that select seems to fix it...
> Does anyone have any clue as to what is going on here?
> Cheers,
> Andrew
>
> On Mar 15, 2:31 pm, Andrew <ajpere...@googlemail.com> wrote:
>> I may have found the problem.....
>>
>> It turns out this problem only occurs if I use the cherrypy auth_basic
>> to provide authentication.
>> In my authentication checkpassword function I was querying the user
>> table without using sessions.
>> Adding a session rollback, clear and close to the end of this function
>> removes the problem.
>>
>> I had wrongly assumed that using a tool to wrap requests in
>> transactions that the authentication would also be wrapped.
>>
>> So far so good...
>>
>> On Mar 15, 11:25 am, Andrew <ajpere...@googlemail.com> wrote:
>>
>>
>>
>> > Hi, I have a problem where multiple connections to a MySQL database
>> > (through sqlalchemy from a cherrypy multithreaded web server) get
>> > different views on the same data.
>> > Scenario:
>> >                 A user submits a form to create a new record in a
>> > table
>> >                 Cherrypy adds the record  and returns an httpredirect
>> > to a url that views that new record
>> >                 The new http request fails as it does not think the
>> > new record exists yet.
>> >                 Refreshing the page after a few seconds successfully
>> > finds the record.
>> > More info:
>> > 1)This website worked perfectly when I used sqlite as a backend.
>> > 2)Even with mysql as a backend, if I query the database from a mysql
>> > gui  just after creating the new record via the web, then I cannot get
>> > this behaviour to happen.
>> > 3)Turning echo on for sqlalchemy reveals that the select statement is
>> > being issued.
>> > 4)This problem only seems to happen if the web page also contains
>> > multiple static images that are being requested at the same time - if
>> > I make the page only reference one image the problem goes away -
>> > suggests some timing problem I guess.
>> > 5) I am using elixir and the sqlalchemy_tool wrapper to manage the
>> > session
>>
>> > Any help/pointers would be really appreciated.
>> > Best Regards,
>> > Andrew
>
> --
> You received this message because you are subscribed to the Google Groups
> "sqlalchemy" group.
> To post to this group, send email to sqlalch...@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.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalch...@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