title: Parsing SQL with Python
body: <p>I want to create a SQL interface on top of a non-relational data store. Non-relational data store, but it makes sense to access the data in a relational manner.</p>
  
  <p>I am looking into using <a href="http://www.antlr.org/" rel="noreferrer">ANTLR</a> to produce an AST that represents the SQL as a relational algebra expression. Then return data by evaluating/walking the tree.</p>
  
  <p>I have never implemented a parser before, and I would therefore like some advice on how to best implement a SQL parser and evaluator.</p>
  
  <ul>
  <li>Does the approach described above sound about right?</li>
  <li>Are there other tools/libraries I should look into? Like <a href="http://www.dabeaz.com/ply/" rel="noreferrer">PLY</a> or <a href="https://pypi.org/project/pyparsing/" rel="noreferrer">Pyparsing</a>.</li>
  <li>Pointers to articles, books or source code that will help me is appreciated.</li>
  </ul>
  
  <p><strong>Update:</strong></p>
  
  <p>I implemented a simple SQL parser using pyparsing. Combined with Python code that implement the relational operations against my data store, this was fairly simple.</p>
  
  <p>As I said in one of the comments, the point of the exercise was to make the data available to reporting engines. To do this, I probably will need to implement an ODBC driver. This is probably a lot of work.</p>