]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
Revert additional usage changes introduced when moving to 2.0 style examples 7829/head
authorprovinzkraut <25355197+provinzkraut@users.noreply.github.com>
Mon, 21 Mar 2022 11:30:39 +0000 (12:30 +0100)
committerprovinzkraut <25355197+provinzkraut@users.noreply.github.com>
Mon, 21 Mar 2022 11:30:39 +0000 (12:30 +0100)
The examples should now reflect their 1.x counterparts 1-1, without any additional usage changes, as discussed in #7829

doc/build/faq/performance.rst
doc/build/orm/loading_columns.rst

index d1d1411359148699dec44d5846a3978d2be60061..9da73c7a7d262d706e0feb5db9c510e87784d243 100644 (file)
@@ -271,7 +271,7 @@ Below is a simple recipe which works profiling into a context manager::
 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::
index 87f0c1fa148c9afe283a8476949ae32a918e32ed..2ec20180a25a4461d3c282e02f3bdb4c88b6901b 100644 (file)
@@ -75,7 +75,7 @@ basic query options are :func:`_orm.defer` and
 
     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"
@@ -89,6 +89,7 @@ using :func:`_orm.undefer_group`, sending in the group name::
 
     stmt = select(Book)
     stmt = stmt.options(undefer_group('photos'))
+    session.scalars(stmt).all()
 
 
 .. _deferred_loading_w_multiple: