On Sep 10, 2007, at 7:40 AM, Glauco wrote:
> > Yes this is strange.. but i want (if is possible) to implement in > select process, a condition that is evaluated as a result of > classmethod. > > In my case i must select all person from my database that are inside a > geografical circle with coordinate = x,y... and radius = z. > > i must use a callable (wich is called for each item) because the > inside > or outside is calculated for each item. > i cannot iterate over result of the qry, because after this particular > condition i must add more other filter condition . > > > My workflow data is something like > > my_base_qry = select ..... > > if condition1: > my_base_qry = my_base_qry.filter( ...) > > if coordinate: > my_base_qry = my_base_qry.filter( my_method_inside_circle ( > latitude, longitude,radius) ) > > if condition3: > my_base_qry = my_base_qry.filter( ...) > > ---- > if condition_n: > my_base_qry = my_base_qry.filter( ...) > that looks like workable code to me, whats the issue ? you want to embed the if/then logic inside the Query ? you can have your Circle.whatever property implement __eq__() or similar, which returns a ClauseElement based on a conditional, if you want.... query.filter (Circle.my_special_method == 5) etc. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---