Hello, Booleano and Geniusql seem to be two different things: * If you need to *parse* a text-based filter (aka "boolean expression"), use Booleano. * If you already have the data in a useful form (i.e., no need to parse anything), use Geniusql.
BTW, you can use a Booleano parse tree not only to create an SQL `WHERE` clause, but also to create a SQLAlchemy filter, for example -- you can turn these trees into anything you need (or at least that's the goal). Cheers, - Gustavo. Robert said: > Heck, if all you want is the back end, Geniusql (and therefore Dejavu) allows you to build comparison expressions and combine them with "+", "&", and "|": > >>> from geniusql import logic > >>> a = logic.comparison('Name', 6, ['Dave', 'Jerry', 'Sue']) > >>> a > > logic.Expression(lambda x: x.Name in ['Dave', 'Jerry', 'Sue']) > > >>> b = logic.comparison('Size', 2, 30) > >>> b > > logic.Expression(lambda x: x.Size == 30) > > >>> a + b > > logic.Expression(lambda x: (x.Name in ['Dave', 'Jerry', 'Sue']) and > (x.Size == 30)) > > >>> a & b > > logic.Expression(lambda x: (x.Name in ['Dave', 'Jerry', 'Sue']) and > (x.Size == 30)) > > >>> a | b > > logic.Expression(lambda x: (x.Name in ['Dave', 'Jerry', 'Sue']) or (x.Size > == 30)) > > >>> c = logic.Expression(lambda g, h: g.Name == h.Name) > >>> c > > logic.Expression(lambda g, h: g.Name == h.Name) > > >>> a + c > > logic.Expression(lambda x, h: (x.Name in ['Dave', 'Jerry', 'Sue']) and > (x.Name == h.Name)) > > You then pass those to the storage layer where they are automatically > converted to backend-specific SQL etc. Been runnin' like a champ for years, > not days. [1] > > > Robert Brewer > fuman...@aminus.org > > [1] OK, I did have to commit a patch just now for comparison() in > py2.5+--but it's a short one ;) > http://www.aminus.net/geniusql/changeset/280 -- Gustavo Narea <xri://=Gustavo>. | Tech blog: =Gustavo/(+blog)/tech ~ About me: =Gustavo/about | _______________________________________________ Web-SIG mailing list Web-SIG@python.org Web SIG: http://www.python.org/sigs/web-sig Unsubscribe: http://mail.python.org/mailman/options/web-sig/archive%40mail-archive.com