We currently have 5 or more systems for generating sql queries, it's a bit silly. SQLAlchemy from #302 might make this a lot easier to resolve, since we could use their query builder rather than having a bunch of different syntax generators like we have right now.