Further model cleanups

Adds .where() and .join() stuff to SQLQuery().  This greatly simplifies
api.py but should remain flexible enough, I think.

Results from SQLQuery are now models, but doing a obj.to_dict() on the
top level objects recurses and converts all objects to dictionaries.