Well, turns out that it doesn't take much of a pool at all to get the test
to fail: http://pastebin.com/trHhiG47

On Thu, Nov 4, 2010 at 10:33 PM, Lenza McElrath <le...@lenza.org> wrote:

> Interesting.  When I use your simple engine I do not get the error either,
> but I definitely get it when using my real configuration.  We are using a
> connection pool.  So the construction of the session maker for the test
> looks like this:
>
> e = sqlalchemy.create_engine('mysql://', pool=connections.get_pool())
> sessionmaker = sqlalchemy.orm.sessionmaker(e)
>
> The connection pool is somewhat complex, so I will try to find the simplest
> possible pool that reproduces the problem.  But, do you have ideas based on
> this?  The script only fails when I use a Float type with a test_value that
> is higher percision than the DB can represent.  It works when I use an
> Integer type, or when test_value is 44 or 0.44.
>
> Thanks for your help!
>
>
> On Thu, Nov 4, 2010 at 6:18 PM, Michael Bayer <mike...@zzzcomputing.com>wrote:
>
>>
>> On Nov 4, 2010, at 8:17 PM, Lenza McElrath wrote:
>>
>> I am getting a StaleDataError when updating a Float column to the same
>> value twice in a row.  This happens because SQLAlchemy thinks that I am
>> changing the value, but then the DB reports that no value was changed.
>>
>> Test case can be seen here: http://pastebin.com/vxFBAMxm
>>
>>
>> the test fails to note what "sessionmaker" is, if I run it like this:
>>
>>     e = create_engine('mysql://scott:ti...@localhost/test')
>>     test_class = UpdateFunctionTest(sessionmaker(e))
>>
>> the script runs as expected with no errors.   StaleDataError only occurs
>> if you execute() an update() or delete() construct that affects the primary
>> key or version number of a row in the same transaction as one that also
>> calls flush() and also targets that row.  This test doesn't emit any raw SQL
>> constructs nor does it modify any primary key attributes or use version ids
>> so no error occurs.   Float columns that aren't primary keys have nothing to
>> do with StaleDataError.
>>
>>
>>  --
>> 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<sqlalchemy%2bunsubscr...@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