You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The SQLAlchemy best practices returns a Result object, containing Row objects when you use the .execute() method. You'll need to use the .scalar() or .scalars() methods to get the ORM objects you declared, which will then have the mixin methods you are looking for.
with Session(engine(), future=True) as db:
results = db.execute(select(MyData)).scalars().all()
Or as a shorthand:
with Session(engine(), future=True) as db:
results = db.scalars(select(MyData)).all()
Is there work being done/are there plans to update these Mixins to work with current SQLAlchemy?
Assume I have a table:
And I want to retrieve some data from the database in that table, so I use current SQLAlchemy best practices:
Attempting to use
.to_dict()
will fail with the error:If, instead, I use the deprecated method, I get success.
The text was updated successfully, but these errors were encountered: