On Thu, Sep 06, 2007 at 09:16:55AM -0500, Ross Bates wrote: > A Saturday 01 September 2007, Ross Bates escrigué: > >> Hi All - I'm new to Python and I am learning the language by > >> experimenting with PyTables, so this question might seem simple. > >> > >> I want to be able to execute a table.where condition with a list of > >> values for the column. Like a SQL 'in' statement > >> > >> So instead of this repeating the column > >> > >> table.where("(src_id == 'x') | ((src_id) == 'y')") > >> > >> it would be something like this: > >> > >> table.where("(src_id == 'x' | 'y' ") > >> > >> I've tried a variety of things and just want to make sure there is > >> not something I'm missing. > > >Currently, you should keep using the former expression. The later > >expression is actually a shortcut of the first one, but this is not > >supported by PyTables (actually, by the integrated numexpr package), > >and it is not in our plans to implement it anytime soon. > > > Hi Francesc - thanks for the response and nice welcome. I'm really > digging Python so far, > > I understand that the condensed where statement is not supported by > the numexpr package, the question I have which remains is more about > Python best practices in this situation. > > If I had a program which accepted 1 or more users parameters as values > for the table.where clause, is dynamically building the condition to > acheive an in-kernel select acceptable? > > If it's possible, I like to avoid code that generates code so I'm just > wondering if that's the only option.
I'm sorry, but I don't completely understand what you mean. In principle yes, the option I mentioned you is the only option, but, could you please give an explicit example on what you are trying to do? Knowing this perhaps I can come with more insightful suggestions. Cheers, Francesc ------------------------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/ _______________________________________________ Pytables-users mailing list Pytables-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/pytables-users