Hi there.

I have just mirgated to 0.3.8 from 0.3.6 and got the followin error in
my app:
<class 'sqlalchemy.exceptions.NoSuchColumnError'>

Investigation shows, that queries generated in 0.3.6 and 0.3.8 are
differ:

(diff, i changed all spaces to line breaks before):
--- 1   2007-06-06 14:40:44.000000000 +0400
+++ 2   2007-06-06 14:40:50.000000000 +0400
@@ -240,64 +240,6 @@
 task_id

 FROM
-(SELECT
-task.id
-AS
-task_id,
-prop_c_s.task_id
-AS
-prop_c_s_task_id,
-task.updated
-AS
-task_updated
-
-FROM
-task
-JOIN
-(SELECT
-task.id
-AS
-task_id,
-count(msg.id)
-AS
-props_cnt
-
-FROM
-task
-LEFT
-OUTER
-JOIN
-msg
-ON
-task.id
-=
-msg.task_id
-GROUP
-BY
-task.id)
-AS
-prop_c_s
-ON
-task.id
-=
-prop_c_s.task_id
-
-WHERE
-(task.prj_id
-=
-%s)
-ORDER
-BY
-task.updated
-DESC
-
-
-LIMIT
-10
-OFFSET
-0)
-AS
-tbl_row_count,
 task
 JOIN
 (SELECT
@@ -439,24 +381,12 @@
 task.task_type_id

 WHERE
-task.id
-=
-tbl_row_count.task_id
-AND
-task.id
-=
-tbl_row_count.prop_c_s_task_id
-AND
-prop_c_s.task_id
-=
-tbl_row_count.task_id
-AND
-prop_c_s.task_id
+(task.prj_id
 =
-tbl_row_count.prop_c_s_task_id
+%s)
 ORDER
 BY
-tbl_row_count.task_updated
+task.updated
 DESC,
 anon_1649.id,
 anon_f48c.task_id,
@@ -470,7 +400,7 @@
 anon_3d17.task_id,
 anon_0e68.id
 2007-06-04
-19:58:33,976

The query is following:

        j  = outerjoin( task_t, message_t,
task_t.c.id==message_t.c.task_id)
        jj = select([ task_t.c.id.label('task_id'),
                      func.count(message_t.c.id).label('props_cnt')],
                      from_obj=[j],
group_by=[task_t.c.id]).alias('prop_c_s')
        jjj = join(task_t, jj, task_t.c.id == jj.c.task_id)
#        jjj = outerjoin(task_effort_t, jjj, task_effort_t.c.task_id
== jjj.c.task_id)

        cls.mapper = mapper( cls, jjj,
order_by=[desc(task_t.c.updated)],
                      properties=dict(type=relation(Task_Type,
lazy=False),
                                      status=relation(Task_Status,
lazy=False, uselist=False),
                                                      
publication=relation(Task_Publication,
lazy=False, uselist=False),
 
summary=deferred(task_t.c.summary),
                                      progress=relation(Task_Progress,
lazy=False, uselist=False),
 
appointment=relation(Task_Appointment, lazy=False, uselist=False),
                                     ))

the idea of this query that I make mapper for join for some tables
which already have mappers,
and add some group functions.  It worked ok in 0.3.6

and (not exactly, but something like)

session.query(cls.mapper).limit(...).offset().list

It works pretty good without limit/offset. Does anybody have idea,
what's happened?
Is it my fault, or it's may be a bug in 0.3.8 ?

I may, of course, roll back to 0.3.6, but I do not want to, and there
is a some bug with unicode rows in 0.3.6, wich made me updrade the
version.


--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to