[sqlalchemy] Re: Filter by optional attributes.

2008-07-15 Thread az
use keywordargs as dictionary, i.e. ...query.filter( **kwargs) where the kwargs are a dict made by u containing only the required fields. e.g. kwargs={} if foo_id: kwargs['fooid']=fooid ... u can make it more generic (but more dangerous) by passing any kwargs coming to your func straight down

[sqlalchemy] Re: Filter by optional attributes.

2008-07-15 Thread Heston James - Cold Beans
Hi Svil: use keywordargs as dictionary, i.e. ...query.filter( **kwargs) where the kwargs are a dict made by u containing only the required fields. e.g. kwargs={} if foo_id: kwargs['fooid']=fooid That sounds like a fair enough solution to me, seems safer than the more generic version.

[sqlalchemy] Re: Filter by optional attributes.

2008-07-15 Thread Heston James - Cold Beans
Hello Again Svil: That sounds like a fair enough solution to me, seems safer than the more generic version. Thanks for the tip mate, sounds really great. I'll play around with that concept. Heston I've tested this little concept and it works really nicely :-D thanks. One quick question

[sqlalchemy] Re: Filter by optional attributes.

2008-07-15 Thread Heston James - Cold Beans
Hi, pass an echo=True to the create_engine() (or whereever else u could pass that) and u'll see the sql. Ok, I see! Perfect! I've just configured logging on this so I can keep track, looks excellent. Heston --~--~-~--~~~---~--~~ You received this message