Hi,

I have a problem on using Decimal type along with SQLAlchemy, the
decimal value could not be used for any computation after querying
something with SQLAlchemy object. This is reproducable in my machine:

import decimal
from tbl import SBCITM

pval = decimal.Decimal(decimal.Decimal('0.999') * 99)
print 'value of type %s was %s' % (type(pval), pval)

obj = SBCITM.query.filter_by(SCITKYID = 3).first()
if not obj:
   raise Exception('record id could be found in the database')

pval = decimal.Decimal(decimal.Decimal('0.999') * 99)
print 'value of type %s was %s' % (type(pval), pval)

output from the script:

>> value of type <class 'decimal.Decimal'> was 98.901
>> value of type <class 'decimal.Decimal'> was 1E+2

I'm using SQLAlchemy + Elixir with MSSQL, option used:

  db_opts = opts or {}
  db_opts['strategy'] = 'threadlocal'
  db_opts['pool_size'] = 8
  db_opts['pool_recycle'] = 1800
  db_opts['max_overflow'] = 16
  db_opts['echo'] = False
  db_opts['echo_pool'] = False
  db_engine = sa.create_engine(url, **db_opts)
  elixir.metadata.bind = db_engine
  elixir.setup_all(True, checkfirst=True)

Please help,

Salam,

-Jaimy.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalchemy@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to