The examples should now reflect their 1.x counterparts 1-1, without any additional usage changes, as discussed in #7829
To profile a section of code::
with profiled():
- session.execute(select(FooClass).where(FooClass.somevalue==8)).all()
+ session.scalars(select(FooClass).where(FooClass.somevalue==8)).all()
The output of profiling can be used to give an idea where time is
being spent. A section of profiling output looks like this::
stmt = select(Book)
stmt = stmt.options(defer('summary'), undefer('excerpt'))
- session.execute(stmt)
+ session.scalars(stmt).all()
Above, the "summary" column will not load until accessed, and the "excerpt"
stmt = select(Book)
stmt = stmt.options(undefer_group('photos'))
+ session.scalars(stmt).all()
.. _deferred_loading_w_multiple: