title: Building a DSL query language
body: <p>i'm working on a project (written in Django) which has only a few entities, but many rows for each entity.</p>
  
  <p>In my application i have several static "reports", directly written in plain SQL. The users can also search the database via a generic filter form. Since the target audience is really tech-savvy and at some point the filter doesn't fit their needs, i think about creating a query language for my database like <a href="http://developer.yahoo.com/yql/console/" rel="noreferrer">YQL</a> or <a href="https://confluence.atlassian.com/display/JIRA/Advanced+Searching" rel="noreferrer">Jira's advanced search</a>.</p>
  
  <p>I found <a href="http://sourceforge.net/projects/littletable/" rel="noreferrer">http://sourceforge.net/projects/littletable/</a> and <a href="http://www.quicksort.co.uk/DeeDoc.html" rel="noreferrer">http://www.quicksort.co.uk/DeeDoc.html</a>, but it seems that they only operate on in-memory objects. Since the database can be too large for holding it in-memory, i would prefer that the query is translated in SQL (or better a Django query) before doing the actual work.</p>
  
  <p>Are there any library or best practices on how to do this?</p>