data: close file if result is not iterator
Merge pull request #272 from mrocklin/sort-head

Add `Sort` and `Head` operations to table expressions
pep8
Merge pull request #270 from mrocklin/lazy-data

Data layer supports streaming access with `.py` getitem
ensure that By.apply is a reduction
expr: by schema
expr: reduction schema maintains record shape
rename sql reductions to original column name
Use label rather than alias to rename reductions

as per
http://stackoverflow.com/questions/9187530/using-alias-for-select-as-in-sqlalchemy
data: sql: include grouping columns
streaming reductions for Python layer

This is a kludge that works only in a very limited setting.
We should implement scalar expressions and then use those.
py3 fix