Fix a few doctest failures related to auto increment sequences

Now I feel dirty.
Remove a few unused imports
Take another stab at fixing the get_query_?set mess

Refs #316.