title: Can I get table names along with column names using .description() in Python's DB API?
body: <p>I am using Python with SQLite 3. I have user entered SQL queries and need to format the results of those for a template language.</p>
  
  <p>So, basically, I need to use .description of the DB API cursor (PEP 249), but I need to get both the column names <strong>and</strong> the table names, since the users often do joins.</p>
  
  <p>The obvious answer, i.e. to read the table definitions, is not possible -- many of the tables have the same column names.</p>
  
  <p>I also need some intelligent behaviour on the column/table names for aggregate functions like avg(field)...</p>
  
  <p>The only solution I can come up with is to use an SQL parser and analyse the SELECT statement (sigh), but I haven't found any SQL parser for Python that seems really good?</p>
  
  <p>I haven't found anything in the documentation or anyone else with the same problem, so I might have missed something obvious?</p>
  
  <p>Edit: To be clear -- the problem is to find the result of an SQL select, where the select statement is supplied by a user in a user interface. I have no control of it. As I noted above, it doesn't help to read the table definitions.</p>