WIP: Refactoring SQL code into per-flavor classes.
Still don't have down the code to dispatch appropriately (though I'm not
even clear why the existing code has individual flavors, given that it
appears to only accept SQLAlchemy objects anyways). Also would be
helpful to cover additional cases where we get connections and want to
convert to cursors.

@jtratner , superceded by #5950?
 Yes
