Why SQLAlchemy Update returns LegacyCursorResult?

Viewed 60

I'm looking for a way to return the rows updated by my query, my idea was to do a fetchall() on the result, but the result has a LegacyCursorResult type and this method is not available, any idea how can I get a CursorResult type, or why do I get Legacy?

>>> with SessionLocal() as db:
...     stmt = (
...             update(MyTable)
...             .where(MyTable.status=="queued")
...             .values({"status": "blocked"})
...     )
...     r = db.execute(stmt)
...
>>> r
<sqlalchemy.engine.cursor.LegacyCursorResult object at 0x7fe>

0 Answers
Related