SQLALchemy threading class