Hey Everyone,

I read the thread that asked this same question for Oracle connection.

I am doing raw SQL executes on a create_engine object, and would like my 
numeric results to be in float instead of decimal.

How would I achieve it ?

The postgres psycopg2 module allows this (have not tested this) using this 
snippet of code, but do not know how I would make this happen in sqlalchemy.

DEC2FLOAT = psycopg2.extensions.new_type( psycopg2.extensions.DECIMAL.values
, 'DEC2FLOAT', lambda value, curs: float(value) if value is not None else 
None) psycopg2.extensions.register_type(DEC2FLOAT)

doing 

engine = create_engine(..)
engine.dialect._to_decimal = float

does not work.

Please let me know if anyone has ideas.

Thanks,
Bhaskar

-- 
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 http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to