HTSQL 2.2 : A Query Language for the Accidental Programmer
Clark C. Evans
cce at clarkevans.com
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',
campus=u'old')
# For schools in the old campus, get # of associated programs and
departments.
>>> 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
http://htsql.org/doc/embed.html
Homepage: http://htsql.org
Download: http://pypi.python.org/pypi/HTSQL
Source: http://bitbucket.org/prometheus/htsql
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 http://htsql.org/blog/htsql-2.2-final.html
Please join us at #htsql on irc.freenode.net
Clark C. Evans & Kirill Simonov
More information about the Python-announce-list
mailing list