Re: [sqlalchemy] Decimals generated as strings in query

2017-07-28 Thread Samer Atiani
Makes sense. I modified my code to look like this for cross DB compatibility - which I believe is identical to the workaround you mention in issue #3891 - I'm pasting it here for others who may face the same problem: class _cast_on_mysql(ColumnElement): def __init__(self, bindvalue, *args,

Re: [sqlalchemy] Decimals generated as strings in query

2017-07-28 Thread Mike Bayer
On Fri, Jul 28, 2017 at 1:46 PM, Samer Atiani wrote: > The way I'm handling this is by creating a TypeDecorator with the following > function: > > > def bind_expression(self, value): > """ > The objective of this is to force MySQL to deal with bind >

Re: [sqlalchemy] Decimals generated as strings in query

2017-07-28 Thread Samer Atiani
The way I'm handling this is by creating a TypeDecorator with the following function: def bind_expression(self, value): """ The objective of this is to force MySQL to deal with bind parameters as decimals rather than as strings. MySQL for some insane reason

Re: [sqlalchemy] Decimals generated as strings in query

2015-04-13 Thread Gabriel Becedillas
Dear Michael, Thanks a lot for your reply. In trying to narrow the problem as much as possible, I missed something important in my example. I'm actually doing an UPDATE, not a SELECT. When I wrote 'I tried casting my decimals using sqlalcheme.cast(..., sqlalchemy.Numeric(precision=16, scale=8))

Re: [sqlalchemy] Decimals generated as strings in query

2015-04-13 Thread Mike Bayer
On 4/13/15 2:25 PM, Gabriel Becedillas wrote: Dear Michael, Thanks a lot for your reply. In trying to narrow the problem as much as possible, I missed something important in my example. I'm actually doing an UPDATE, not a SELECT. When I wrote 'I tried casting my decimals using

Re: [sqlalchemy] Decimals generated as strings in query

2015-04-13 Thread Gabriel Becedillas
Thanks a lot Mike. Although I did see the Specify 'fetch' or False for the synchronize_session parameter in the error I associated that with a connection-time parameter and I thought 'no.. that has nothing to do with my problem'. My bad. Thanks a lot. On Mon, Apr 13, 2015 at 3:31 PM, Mike Bayer

Re: [sqlalchemy] Decimals generated as strings in query

2015-04-13 Thread Mike Bayer
On 4/13/15 11:50 AM, Gabriel Becedillas wrote: Dear all, I have a table that has 2 numeric columns, and I'm writing a query that performs some arithmetic on the filter clause between those columns and a Decimal. The problem that I'm facing is that I don't get any results at all. After a

[sqlalchemy] Decimals generated as strings in query

2015-04-13 Thread Gabriel Becedillas
Dear all, I have a table that has 2 numeric columns, and I'm writing a query that performs some arithmetic on the filter clause between those columns and a Decimal. The problem that I'm facing is that I don't get any results at all. After a while I realized that the SQL statement getting