summaryrefslogtreecommitdiff
path: root/doc/build/orm/session_basics.rst
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2020-09-25 22:31:16 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2020-10-31 13:44:53 -0400
commit654b462d668a2ced4e87077b9babb2590acbf983 (patch)
tree8b6023480423e990c9bbca7c280cb1cb58e012fc /doc/build/orm/session_basics.rst
parent841eb216644202567ebddfc0badc51a3a35e98c3 (diff)
downloadsqlalchemy-review/mike_bayer/tutorial20.tar.gz
Add SelectBase.exists() method as it seems strange this is not available already. The Exists construct itself does not provide full SELECT-building capabilities so it makes sense this should be used more like a scalar_subquery. Make sure stream_results is getting set up when yield_per is used, for 2.0 style statements as well. this was hardcoded inside of Query.yield_per() and is now moved to take place within QueryContext. Change-Id: Icafcd4fd9b708772343d56edf40995c9e8f835d6
Diffstat (limited to 'doc/build/orm/session_basics.rst')
-rw-r--r--doc/build/orm/session_basics.rst12
1 files changed, 4 insertions, 8 deletions
diff --git a/doc/build/orm/session_basics.rst b/doc/build/orm/session_basics.rst
index 79af8f27f..8cec8a18e 100644
--- a/doc/build/orm/session_basics.rst
+++ b/doc/build/orm/session_basics.rst
@@ -492,6 +492,7 @@ ways to refresh its contents with new data from the current transaction:
session.expire(u1)
u1.some_attribute # <-- lazy loads from the transaction
+
..
* **the refresh() method** - closely related is the :meth:`_orm.Session.refresh`
@@ -539,7 +540,7 @@ time refresh locally present objects which match those rows.
To emit an ORM-enabled UPDATE in :term:`1.x style`, the :meth:`_query.Query.update` method
may be used::
- session.query(User).filter(User.nane == "squidward").\
+ session.query(User).filter(User.name == "squidward").\
update({"name": "spongebob"}, synchronize_session="fetch")
Above, an UPDATE will be emitted against all rows that match the name
@@ -551,10 +552,7 @@ objects locally present in memory will be updated in memory based on these
primary key identities.
For ORM-enabled UPDATEs in :term:`2.0 style`, :meth:`_orm.Session.execute` is used with the
-Core :class:`_sql.Update` construct. The :meth:`_orm.Session` must
-be configured with :paramref:`_orm.Session.future` set to ``True``::
-
- session = Session(future=True)
+Core :class:`_sql.Update` construct::
from sqlalchemy import update
@@ -575,10 +573,8 @@ ORM-enabled delete, :term:`1.x style`::
session.query(User).filter(User.nane == "squidward").\
delete(synchronize_session="fetch")
-ORM-enabled delete, :term:`2.0 style`. The :meth:`_orm.Session` must
-be configured with :paramref:`_orm.Session.future` set to ``True``::
+ORM-enabled delete, :term:`2.0 style`::
- session = Session(future=True)
from sqlalchemy import delete
stmt = delete(User).where(User.nane == "squidward").execution_options(synchronize_session="fetch")