Hello,

I get the warning message "SAWarning: Dialect sqlite+pysqlite does *not* 
support Decimal objects natively, and SQLAlchemy must convert from floating 
point", without me using a Decimal object anywhere, which was highly 
confusing.

This occurs when evaluating a hybrid property multiplying an 
sqltypes.Integer column with a python float literal (0.5), which I would 
expect to result in a float.
It seems to be caused by two weird looking definitions in sqltypes.py:

class Numeric(_DateAffinity, TypeEngine): ...
    def __init__(self, ..., asdecimal=True): ...


_type_map = {...
    float: Numeric(), ...


Is there a reason, why floats are treated as decimals (instead of binary 
floating points?) by default, and a way to prevent this from happening when 
defining the following property?


@my_hybrid_property.expression
def my_hybrid_property(cls):
    return cls.my_integer_column * 0.5


Greetings,

Phillip Kuhrt

-- 
SQLAlchemy - 
The Python SQL Toolkit and Object Relational Mapper

http://www.sqlalchemy.org/

To post example code, please provide an MCVE: Minimal, Complete, and Verifiable 
Example.  See  http://stackoverflow.com/help/mcve for a full description.
--- 
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 sqlalchemy+unsubscr...@googlegroups.com.
To post to this group, send email to sqlalchemy@googlegroups.com.
Visit this group at https://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.

Reply via email to