exhuma.twn ha scritto:
> I have seen that in SA 0.4 on can do something like:
>
> q = table.select()
> q = q.where(x=1)
> q = q.where(z=2)
> ...
>
> Is this also possible in SA 0.3?
>
> I want to build a web-page where a user can refine filters on the go,
> to perform a drill-down in a data set. Doing this with plain-text SQL
> is fairly easy, but doing it with SA is not as straight-forward.
>
> Considering this scenario, would it be possible to *remove* one such
> filter from a query? Say, remove the "x=1" from the above query.
>   

You must post-pone rendering of qry where clause...

where_clause = []
where_clause.append( <cond1> )
where_clause.append( <cond2> )
where_clause.append( <cond3> )


you can  at this point of programm remove some condition positinally or 
by content.

where_clause.pop( <cond2>)
or
del where_clause[1]



finally you can rendere your qry:


your_base_qry = session.query( <bla bla> )
if where_clause:
       your_removed_qry = your_base_qry.filter( and_( *where_clause ) )





Glauco

-- 
+------------------------------------------------------------+
                                  Glauco Uri - Programmatore
                                    glauco(at)allevatori.com 
                               
  Sfera Carta Software®      [EMAIL PROTECTED]
  Via Bazzanese,69  Casalecchio di Reno(BO) - Tel. 051591054 
+------------------------------------------------------------+



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