So that's what was happening:

This select construct *fails*:
select_query = select()
select_query.append_column(contract_id)
select_query.append_column(cancel_dt)
select_query.append_column(cancellation_obj)
select_query.append_from(source_table_name)


But this select construct *works*:
select_query = select([source_table.c.contract_id, source_table.c.cancel_dt, 
source_table.c.cancellation_quote_obj])

So it's just matter of rewriting select query in the 'right' way.

Thanks for pointing in the right direction!
GP

On Monday, March 16, 2015 at 4:57:28 PM UTC-4, GP wrote:
>
> I think now I (probably) know where this may be coming from.
>
> You asked 
> > is the original query a plain string and not a Core SQL expression
>
> The way I am forming the query is by using select , append_column, 
> append_whereclause and finally *append_from*('my_table'). I think this 
> pretty much generates a plain string query and not the one that's tied to a 
> sqlalchemy table type object. And this may be why sqlalchemy is not 
> applying necessary conversion because it doesn't really know the data types 
> of the columns I am selecting?
>
> Apologies if I am simplifying this too much and/or talking nonsense.
>
> Thanks
> GP
>
> On Monday, March 16, 2015 at 3:49:32 PM UTC-4, GP wrote:
>>
>> Thank you Michael.
>>
>> auto_covert_lobs : I ran with all three possible values: True, False, 
>> and without supplying it. The results are the same.
>>
>> The original query is a bit more complicated than the example I gave, and 
>> is built dynamically. But I am using sqlalchemy select, and not a plain 
>> string. Query is of object type "sqlalchemy.select.sql.selectable.Select" 
>> (Or "sqlalchemy.sql.expression.Select"?), if it helps. 
>>
>> Here is what the query object value looks like:
>> SELECT CAST(contract_id AS FLOAT) AS contract_id, cancel_dt AS cancel_dt, 
>> cancellation_obj AS cancellation_obj FROM contract_cancellation WHERE 
>> updated_ts BETWEEN :updated_ts_1 AND :updated_ts_2
>>
>> Let me try calling value().
>>
>>
>> Thanks
>> GP
>>
>

-- 
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/d/optout.

Reply via email to