Thrashing on SQLAlchemy circular dependency errors