use SQLAlchemy context managers to encapsulate transactions