Cleanup sqlalchemy sessions

Rebuilt off of development, and split out the twisted web endpoint.

This pull moves the SQLAlchemy handling from one long-running session to being sessions per transaction. Records are queried from the database, then detached from the session before being returned to the endpoints. Objects that are updated have an invisible session generator that they take with them, isolating the update to its own session and preventing weird locking issues that the old behavior had when dealing with concurrency. This also allows the things actually using the data to not care about session management (which isn't their job)