I have an issue where, I believe due to floating-point representation
issues, reassigning the same value to a floating-point field causes
SQLAlchemy to think the value has been modified, and therefore emits a
gratuitous UPDATE. (This is particularly problematic when using the
versioning mixin,
On Nov 19, 2013, at 8:10 PM, Seth P spadow...@gmail.com wrote:
I have an issue where, I believe due to floating-point representation issues,
reassigning the same value to a floating-point field causes SQLAlchemy to
think the value has been modified, and therefore emits a gratuitous UPDATE.
heh, this is actually some dumb numpy thing, check this out:
from numpy.ma.core import exp
x = exp(1.0)
a = x == x
a
True
a is True
False
there’s your problem, the recipe fixes if you just say this:
class InexactFloat(TypeDecorator):
impl = Float
def compare_values(self, x, y):
Huh. That is odd numpy behavior.
Thanks for the recipe.
On Tuesday, November 19, 2013 8:35:35 PM UTC-5, Michael Bayer wrote:
heh, this is actually some dumb numpy thing, check this out:
from numpy.ma.core import exp
x = exp(1.0)
a = x == x
a
True
a is True
False
there’s your