Published by xi on 2012-06-28
We are proud to announce a new HTSQL release in the 2.3 development series. This release adds a few major features including nested records, nested subqueries, locators, new and revamped output formats, HTSQL-Django gateway, and more.
In this release, we removed support for Python 2.5. Currently HTSQL requires Python 2.6 or 2.7.
Specific changes since the 2.3.0 release:
The following queries demonstrate new HTSQL features.
Show department records with the first field being a nested record for the associated school:
school | code | name | |
---|---|---|---|
code | name | ||
bus | School of Business | acc | Accounting |
la | School of Arts and Humanities | arthis | Art History |
ns | School of Natural Sciences | astro | Astronomy |
For each school, show lists of associated programs and departments:
name | program | department |
---|---|---|
title | name | |
School of Art & Design | Post Baccalaureate in Art History | Studio Art |
Bachelor of Arts in Art History | ||
Bachelor of Arts in Studio Art | ||
School of Business | Master of Arts in Economics | Accounting |
Graduate Certificate in Accounting | Economics | |
Certificate in Business Administration | Management & Marketing | |
B.S. in Accounting | ||
Bachelor of Business Administration | ||
Bachelor of Arts in Economics | ||
Show the department identified by comp:
code | name | school_code |
---|---|---|
comp | Computer Science | eng |
Show course identities:
id() |
---|
acc.100 |
acc.200 |
acc.234 |
Show class identities for all classes of the course comp.515:
id() |
---|
(comp.515).(2007.spring).001 |
(comp.515).(2008.spring).001 |
(comp.515).(2010.spring).001 |
The first school in the list:
code | name | campus |
---|---|---|
art | School of Art & Design | old |
For each school, show the top two programs by the number of students:
name | program | ||||
---|---|---|---|---|---|
school_code | code | title | degree | part_of_code | |
School of Art & Design | art | ustudio | Bachelor of Arts in Studio Art | ba | |
art | uhist | Bachelor of Arts in Art History | ba | ||
School of Business | bus | pbusad | Certificate in Business Administration | ct | |
bus | pacc | Graduate Certificate in Accounting | ct | ||
Output in JSON format:
{
"program": [
{
"school": {
"name": "School of Art & Design"
},
"title": "Post Baccalaureate in Art History",
"degree": "pb"
},
{
"school": {
"name": "School of Art & Design"
},
"title": "Bachelor of Arts in Art History",
"degree": "ba"
},
…
Output in XML format:
<?xml version="1.0" encoding="UTF-8" ?>
<htsql:result xmlns:htsql="http://htsql.org/2010/xml">
<program>
<school>
<name>School of Art & Design</name>
</school>
<title>Post Baccalaureate in Art History</title>
<degree>pb</degree>
</program>
<program>
<school>
<name>School of Art & Design</name>
</school>
<title>Bachelor of Arts in Art History</title>
<degree>ba</degree>
</program>
…
Output in raw format:
{
"meta": {
"domain": {
"type": "list",
"item": {
"domain": {
"type": "record",
"fields": [
{
"domain": {
"type": "record",
"fields": [
{
"domain": {
"type": "text"
},
"header": "name",
"path": "program.school.name",
"syntax": "name",
"tag": "name"
}
]
},
"header": "school",
"path": "program.school",
"syntax": "{name}",
"tag": "school"
},
{
"domain": {
"type": "text"
},
"header": "title",
"path": "program.title",
"syntax": "title",
"tag": "title"
},
{
"domain": {
"type": "text"
},
"header": "degree",
"path": "program.degree",
"syntax": "degree",
"tag": "degree"
}
]
}
}
},
"header": "program",
"path": "program",
"syntax": "\/program{school{name},title,degree}",
"tag": "program"
},
"data": [
[
[
"School of Art & Design"
],
"Post Baccalaureate in Art History",
"pb"
],
[
[
"School of Art & Design"
],
"Bachelor of Arts in Art History",
"ba"
],
…