SQL code generation from table-free boolean queries?

alex23 wuwei23 at gmail.com
Thu Jun 27 21:01:45 EDT 2013


On 27/06/2013 9:17 AM, Foo Stack wrote:
> Given string input such as:
>      foo=5 AND a=6 AND date=now OR date='2013/6' AND bar='hello'
>
> I am going to implement:
>
> - boolean understanding (which operator takes precendence)
> - spliting off of attributes into my function which computes their table in the SQL database
> - piece everything together into an SQL query
>
> However, it came to me that this is probably a very generic thing; and there might be a library for it.

Not a library per se, but I did see an article that did something quite 
similar using SQLAlchemy that might make a good starting point:

http://www.wiggy.net/articles/sqlalchemy-in-reverse




More information about the Python-list mailing list