On Apr 16, 2011, at 3:57 AM, monster jacker wrote:

> query.union_all(query1, query2) is producing below select statement.As
> i added label method to change labels of columns to refer in the code.
> anonimous column names are giving reference errors while accesing
> result set.
> 
> SELECT
>       anon_1.anon_2_row_num AS anon_1_anon_2_row_num,
> anon_1.anon_2_test_msg AS anon_1_anon_2_test_msg,
> anon_1.anon_2_date_created AS anon_1_anon_2_date_created,
> anon_1.anon_2_name_file AS anon_1_anon_2_name_file
> 
> 
> Here we  don't want to have top level select column name with alias
> since i am refering in the code as row_num.
> 
> Can any one suggest what changes to be made in the query.

I'm assuming by "reference error" you're trying to say:

        for row in query:
                row.row_num

this exact issue is resolved in 0.7 and is introduced at 
http://www.sqlalchemy.org/trac/wiki/07Migration#TuplelabelnamesinQueryImproved 
.   The actual query will still have the "anon" stuff going on, since it 
generates subqueries with names like "anon_1" and "anon_2" and then always uses 
the convention <selectablename>_<columnname> in order to identify columns, but 
the original name should be transferred up to the top.






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

Reply via email to