mirror of
https://github.com/sqlalchemy/sqlalchemy.git
synced 2026-05-15 13:17:24 -04:00
Add `scalars` to Migration - ORM Usage table.
Fixes #7407
Change-Id: I0ec7c0dd44dce3b907296824ee4e6103bc72a6dd
(cherry picked from commit d692b11608)
This commit is contained in:
committed by
Mike Bayer
parent
53bb56071d
commit
aaa9b040ce
Vendored
+8
-5
@@ -1206,9 +1206,12 @@ following the table, and may include additional notes not summarized here.
|
||||
session.execute(
|
||||
select(User)
|
||||
).scalars().all()
|
||||
# or
|
||||
session.scalars(select(User)).all()
|
||||
|
||||
- :ref:`migration_20_unify_select`
|
||||
|
||||
:meth:`_orm.Session.scalars`
|
||||
:meth:`_engine.Result.scalars`
|
||||
|
||||
* - ::
|
||||
@@ -1235,11 +1238,11 @@ following the table, and may include additional notes not summarized here.
|
||||
|
||||
- ::
|
||||
|
||||
session.execute(
|
||||
session.scalars(
|
||||
select(User).
|
||||
filter_by(name="some user").
|
||||
limit(1)
|
||||
).scalars().first()
|
||||
).first()
|
||||
|
||||
- :ref:`migration_20_unify_select`
|
||||
|
||||
@@ -1253,7 +1256,7 @@ following the table, and may include additional notes not summarized here.
|
||||
|
||||
- ::
|
||||
|
||||
session.execute(
|
||||
session.scalars(
|
||||
select(User).
|
||||
options(
|
||||
joinedload(User.addresses)
|
||||
@@ -1289,12 +1292,12 @@ following the table, and may include additional notes not summarized here.
|
||||
|
||||
- ::
|
||||
|
||||
session.execute(
|
||||
session.scalars(
|
||||
select(User).
|
||||
from_statement(
|
||||
text("select * from users")
|
||||
)
|
||||
).scalars().all()
|
||||
).all()
|
||||
|
||||
- :ref:`orm_queryguide_selecting_text`
|
||||
|
||||
|
||||
Reference in New Issue
Block a user