Replace SQLAlchemy Expression API with plain SQL

The SQLAlchemy Expression API wasn't really winning us much of anything, and instead made it more difficult to actually understand what was going on.