Thanks for clarifying with a full answer!

> This should not be construed to mean that you should only use the ORM
> with SERIALIZABLE isolation. It's instead just something to be aware of.
> You can of course expire any object or individual attribute at any time. 
In
> this case, if you were to add s2.expire(s2c1) on line 88, you'd then get 
the
> "222" value on the next check as it would emit a SELECT.

But it does seem to emit a select!  The output surrounding the line 88 query 
is below:

Querying s2 again (whose transaction is still open) to see what it gets for 
c1...
    SQL >> SELECT counter.id AS counter_id, counter.name AS counter_name, 
counter.count AS counter_count 
    SQL >> FROM counter 
    SQL >> WHERE counter.name = %(name_1)s
    SQL >> {'name_1': 'C1'}
s2 gets C1.count = 1

... so what were those SQL emmissions about?  They did not seem to arrive at 
the database (based on the result, anyway).

I had thought it may be identity map stuff, regardless of what SQL I saw 
being emitted, which is why I tried the direct query in line 96.  The 
combination of "how the heck did SQLAlchemy know to emit SQL here?" and "ok 
- SQL was emitted, but why didn't it get the response I expect for READ 
COMMITTED?" both drove the line 96 check.

Note that if I add the s2.expire(s2c1) before the line 88 query as you 
suggest, the seemingly emitted SQL output is no different, except that the 
value actually gets updated:

Querying s2 again (whose transaction is still open) to see what it gets for 
c1...
    SQL >> SELECT counter.id AS counter_id, counter.name AS counter_name, 
counter.count AS counter_count 
    SQL >> FROM counter 
    SQL >> WHERE counter.name = %(name_1)s
    SQL >> {'name_1': 'C1'}
s2 gets C1.count = 222

What is happening?  I always trusted the logger output for letting me know 
when the DB was actually being hit, but now I'm not sure I can.

Thanks,
Russ

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/sqlalchemy/-/PenYdOGI1hwJ.
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