HTSQL

Catherine Devlin

SELECT   c.charname,
         c.speechcount,
         w.title
FROM     character c
JOIN     character_work cw
  ON (cw.charid = c.charid)
JOIN     work w
  ON (cw.workid = w.workid)
WHERE    w.genretype = 'c'
ORDER BY c.speechcount DESC;

Itself circumambient and enclosed by its effluvium of hell, its aura of unregeneration, it mused (mused, thought, seemed to possess sentience, as if, though dispossessed of the peace-who was impervious anyhow to fatigue-which she declined to give it, it was still irrevocably outside the scope of her hurt or harm) with that quality peaceful and now harmless and not even very attentive-the ogre-shape which, as Miss Coldfield's voice went on, resolved out of itself before Quentin's eyes the two half-ogre children, the three of them forming a shadowy background for the fourth one.

raw animal fear

Install

pip install htsql-pgsql

Shell

htsql-ctl shell pgsql://will:longliveliz@localhost/shakes

Server

htsql-ctl serve pgsql://will:longliveliz@localhost/shakes

/work

Note

The queries in these slides are links to htsql-ctl running on your local machine. If you want them to work, after installing htsql-pgsql:

git clone git://github.com/catherinedevlin/opensourceshakespeare.git
cd opensourceshakespeare
createuser --superuser --pwprompt will
(edit pg_hba.conf to allow md5 authent for will)
createdb --owner=will shakes

And

(Running htsql as a superuser would be a terrible idea if it were served to machines other than your own, of course.)

/work{title, year}

/character_work{character.name,character.speechcount-,
work.title}?work.genretype='c'

Filtering

/chapter?description~'palace'

Joining

/chapter{work.title,description}

Hierarchical

/work{title, count(chapter), /chapter{description}}

Not scary

Store it

Share it

Hack it

Output formats

/work/:csv

/work/:txt

/work/:json

/work/:xml

Python API

import htsql

db = htsql.HTSQL('''pgsql://will:longliveliz
                    @localhost/shakes''')

for row in db.produce('/work'):
    print '%s, great show!' % row.title

HTRAF

See demo

htsql.org

htraf.org

catherinedevlin.blogspot.com

SpaceForward
Left, Down, Page DownNext slide
Right, Up, Page UpPrevious slide
POpen presenter console
HToggle this help