TST: restructure sql tests

- add some explanation of structure of tests
- general clean-up (some pep8, docstrings, etc)
- move some methods to _TestSQLAlchemy
- use standard quoting for sqlite

I didn't change any tests, so nothing controversial I think. Wanted to do this first, and then in a subsequent PR try to increase the test coverage.