I've just found
http://www.mail-archive.com/sqlalchemy@googlegroups.com/msg14672.html what
answers my question.

sorry for bothering you

On Fri, Jan 28, 2011 at 9:36 PM, Viktor Nagy <viktor.n...@toolpart.hu>wrote:

> Hi,
>
> I would like to build an or_ statement using a for cycle, something like
> the following:
>
>         employeetask_or = or_(False) # to exclude everything not satisfied
> by later appended criteria, is this needed or empty or_() is fine?
>         for period in periods.all():
>             period.close(session, machine_id)
>
> employeetask_or.append(and_(EmployeeTasks.work_id==period.operation.work_id,
>
> EmployeeTasks.is_reparation==period.operation.is_reparation))
>         qry = session.query(EmployeeTasks).filter(and_(employeetask_or,
> EmployeeTasks.paused==None, EmployeeTasks.finished==0))
>
> of course(?) this does not work, and I don't really have any ideas after
> inspecting or_'s methods. Could someone give me a hand, please?
>
> (this inefficient for cycle is needed for a very efficient bulk update)
>
> Viktor
>

-- 
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