HTSQL 2.2 : A Query Language for the Accidental Programmer

Clark C. Evans cce at
Fri Dec 16 04:08:04 CET 2011

We'd like to announce the next release of HTSQL, a high-level
query language for relational databases.  HTSQL is specifically
designed for data analysts & web developers and makes writing and 
maintaining complex queries a pleasure.  HTSQL can be used as a
command-line interpreter, a WSGI application, or a Python library.
  # Create an HTSQL instance.
  >>> from htsql import HTSQL
  >>> htsql = HTSQL("pgsql:htsql_demo")
  # Find all schools matching the given pattern.
  >>> query = "/school?name~$pattern"
  >>> for row in htsql.produce(query, pattern='art'):
  ...     print row
  school(code=u'art', name=u'School of Art and Design', campus=u'old')
  school(code=u'la', name=u'School of Arts and Humanities',
  # For schools in the old campus, get # of associated programs and
  >>> query = "/school{name, count(program), count(department)}?campus='old'"
  >>> for row in htsql.produce(query):
  ...     print "%s: %d programs, %d departments" % row
  School of Art and Design: 3 programs, 2 departments
  College of Education: 7 programs, 2 departments
  School of Arts and Humanities: 9 programs, 5 departments
  School of Natural Sciences: 6 programs, 4 departments 

For more detailed instructions for use with Python, see


Since our 2.1 release, we've focused on usability improvements.  
We've added a web-based query editor with syntax highlighting & 
completion.  We also implemented a new configuration system to 
provide granular meta-data customization.  Finally, we added 
plugins for Django and SQLAlchemy integration.  For a detailed 
list of changes, see

Please join us at #htsql on

Clark C. Evans & Kirill Simonov

More information about the Python-announce-list mailing list