On May 10, 5:13 am, Nicholas Dudfield <ndudfi...@gmail.com> wrote: > Greetings, > > I have been using SQLA for a few months. > > For admin CRUD index pages I have been using a naive search_keywords > function as > seen at end of message. > > Instead of using a primitive shlex.split, which incidentally is not unicode > friendly, and one crude search_type (AND|OR) I'd like to use something > that will > lex/parse a search string and build the queries. > > eg. > ((x or z or y) and q) or not "h m" > > I imagine this would be a fairly common requirement however I can't seem > to find > any implementation anywhere. > > I used google code search with the query "pyparsing sqlalchemy lang:python" > however found no useful results.
Google for "pyparsing query parser" and you'll find some helpful links: http://pyparsing.wikispaces.com/file/view/searchparser.py (source is on the pyparsing wiki, plus it ships with the pyparsing source distribution) http://rephrase.net/days/07/04/pyparsing (a nice walkthrough of a query parser and evaluator) The O'Reilly shortcut "Getting Started with Pyparsing" (not free, but extremely well-written) culminates with the development of a search query parser to search for recipes by querying for matching ingredients ("noodles and (tuna or ham)", "pineapple and not 'pizza crust'", etc.). -- Paul (author of "Getting Started with Pyparsing") --~--~---------~--~----~------------~-------~--~----~ 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 sqlalchemy+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~----------~----~----~----~------~----~------~--~---