Make compatible with sqlalchemy version >= 8