Kent wrote: > I've got a column defined as this: > > Column("cost", Numeric, nullable=False) > > In Oracle, it seems I can't take advantage of the Decimal() class. I > get rounding errors as if using float instead of Decimal, see output > for Oracle vs. Postgres.....
decimal rounding errors have been enhanced so that the scale argument of Numeric is taken into account. so use the latest tip of beta2 and ensure your Numeric has the proper "precision" and "scale" arguments passed. We are also in the middle of re-establishing 100% test coverage for the oracle dialect which has fallen off track so if there are issues in tip you might have to wait, or in the meantime use your own numeric type that converts correctly (i.e. using "%.<precision>f" % value rather than str(value) to create the Decimal). > > > ************Oracle 8i (use_ansi=False): > >>>> itl.cost > Decimal('8.99') >>>> itl.cost = Decimal('5.99') >>>> >>>> DBSession.flush() > 16:21:48,090 INFO [sqlalchemy.engine.base.Engine.0x...4c10] UPDATE > inventorytransactions SET cost=:cost WHERE > inventorytransactions.transactionid = :inventorytransactions_tr_1 > 16:21:48,090 INFO [sqlalchemy.engine.base.Engine.0x...4c10] > {'inventorytransactions_tr_1': 'AAAFD2AAEAAACN/AAA', 'cost': > 5.9900000000000002} >>>> > > > ************postgres: > >>>> DBSession.flush() > 16:30:03,357 INFO [sqlalchemy.engine.base.Engine.0x...4ad0] UPDATE > inventorytransactions SET cost=%(cost)s WHERE > inventorytransactions.transactionid = % > (inventorytransactions_transactionid)s > 16:30:03,357 INFO [sqlalchemy.engine.base.Engine.0x...4ad0] {'cost': > Decimal('5.99'), 'inventorytransactions_transactionid': 'A'} > > > Am I doing something wrong? > > -- > 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.