Finish SQLAlchemy conversion