Hi.

Im still trying to use the select object from sqlalchemy, but i found a
strange (bug or not) behavior:

sql = select(columns=[self.fields], from_obj=self.tables,
whereclause=self.where, bind=self.req.cfg.engine, order_by= ' 1 ')

1) without order by, i get an error:  AttributeError: 'NoneType' object has
no attribute 'proxies'. is this intended?

2) the select fails when theres a CASE instruction, like this:

       case field1
            when 34 then field2
            when 94 then field3
            when 48 then field4
       end another_field

It fails because sqlalchemy does a subquery, but instead of using * (in the
outer query, to bring all the fields) it just paste the same fields from the
original query, failing to get all the fields in the case expression....

example:

original query

select
       case field1
            when 34 then field2
            when 94 then field3
            when 48 then field4
       end another_field
from
table

my self.fields object:
["case field1
            when 34 then field2
            when 94 then field3
            when 48 then field4
       end another_field"]

the select object will translate it to:

select
case field1
            when 34 then field2
            when 94 then field3
            when 48 then field4
       end another_field
from
(select
       case field1
            when 34 then field2
            when 94 then field3
            when 48 then field4
       end another_field
from
table)

In the case above, there will be no field1, 2, 3 and 4, but only
another_field...

The simple fix for this would be for alchemy to replace the fields with
* in the outer query...

Is there any other way to do this?

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalchemy@googlegroups.com
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to