From: provinzkraut <25355197+provinzkraut@users.noreply.github.com> Date: Mon, 21 Mar 2022 11:30:39 +0000 (+0100) Subject: Revert additional usage changes introduced when moving to 2.0 style examples X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a89561dd0c96c2f9a6d992fa0fb94683afaf7e30;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git Revert additional usage changes introduced when moving to 2.0 style examples The examples should now reflect their 1.x counterparts 1-1, without any additional usage changes, as discussed in #7829 --- diff --git a/doc/build/faq/performance.rst b/doc/build/faq/performance.rst index d1d1411359..9da73c7a7d 100644 --- a/doc/build/faq/performance.rst +++ b/doc/build/faq/performance.rst @@ -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:: diff --git a/doc/build/orm/loading_columns.rst b/doc/build/orm/loading_columns.rst index 87f0c1fa14..2ec20180a2 100644 --- a/doc/build/orm/loading_columns.rst +++ b/doc/build/orm/loading_columns.rst @@ -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: