Hello,

I'm working with a database that stores mostly integer values or floats
with little (relevant) precision. Thus, I am using all numeric types
with asdecimal=True.
Unfortunately, our database-calculations return Decimal objects when run
in MySQL, though they return int/float in Sqlite. While I can deal with
either type, the inconsistency is causing some pain -- as we only notice
the lack of return value conversion / db CAST rather late in the
development process.
Generally, I would like the ORM ensure consistent result types for a
query like:
  DBSession.query(func.sum(Table.int_column))

We often handle this as:
  DBSession.query(cast(func.sum(Table.int_column), Integer))

Is there something we can do to generally avoid this type of bug?
E.g., always return all DB-results to float, issue a warning when an
explicit cast is missing and some DBs may return decimal, ... ?

How do you deal with this situation?


Cheers,
Robert

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to