Hi,

I would like to build a query dynamically:
I have a list called process_ids that contains the process ids that
should be included in the result set.
so the or_ tuple has to be filled according to the number of items in
list

here an example with 2 items:

where =
or_(PurchaseRequisitionTable.c.processInstance_ID.in_('klora1170507591.97'),
 
PurchaseRequisitionTable.c.processInstance_ID.in_('meier1170549591.67'),)

what is the best way with sqlalchemy to do this? is there also the
possibilty to provide a list or dic directly?

Below my tries....    cheers Dennis



        rrr =
get_session().query( self.context.domain_model ).select_by(**d)

        if process_ids is not None:
            or = []
            for p in process_ids:
 
or.append(app_schema.PurchaseRequisitionTable.c.processInstance_ID.in_(p))
            t = (i for i in or)
            where = or_(t)


            rrr = rrr.select(where)

        rrr = rrr[int(self.batch_start):int(self.batch_size)]


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