]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
Fix a few typos
authorprovinzkraut <25355197+provinzkraut@users.noreply.github.com>
Sun, 20 Mar 2022 10:38:04 +0000 (11:38 +0100)
committerprovinzkraut <25355197+provinzkraut@users.noreply.github.com>
Sun, 20 Mar 2022 10:38:04 +0000 (11:38 +0100)
Fixes typos introduced when moving parts of the documentation to 2.0 style and implements changes as requested per #7829

doc/build/orm/join_conditions.rst
doc/build/orm/mapped_attributes.rst

index 9a3ca269ac079f9ed657e2e3612af034600faf50..51385efed840757e181527c9d9f7c3673a2f76e0 100644 (file)
@@ -700,7 +700,7 @@ directly.  A query from ``A`` to ``D`` looks like:
 
 .. sourcecode:: python+sql
 
-    select(A).join(A.d))
+    sess.scalars(select(A).join(A.d)).all()
 
     {opensql}SELECT a.id AS a_id, a.b_id AS a_b_id
     FROM a JOIN (
@@ -801,7 +801,7 @@ With the above mapping, a simple join looks like:
 
 .. sourcecode:: python+sql
 
-    select(A).join(A.b)
+    sess.scalars(select(A).join(A.b)).all()
 
     {opensql}SELECT a.id AS a_id, a.b_id AS a_b_id
     FROM a JOIN (b JOIN d ON d.b_id = b.id JOIN c ON c.id = d.c_id) ON a.b_id = b.id
@@ -827,7 +827,7 @@ A query using the above ``A.b`` relationship will render a subquery:
 
 .. sourcecode:: python+sql
 
-    select(A).join(A.b)
+    sess.scalars(select(A).join(A.b)).all()
 
     {opensql}SELECT a.id AS a_id, a.b_id AS a_b_id
     FROM a JOIN (SELECT b.id AS id, b.some_b_column AS some_b_column
@@ -838,12 +838,12 @@ so in terms of ``B_viacd_subquery`` rather than ``B`` directly:
 
 .. sourcecode:: python+sql
 
-    (
+    sess.scalars(
         select(A)
         .join(A.b)
         .where(B_viacd_subquery.some_b_column == "some b")
         .order_by(B_viacd_subquery.id)
-    )
+    ).all()
 
     {opensql}SELECT a.id AS a_id, a.b_id AS a_b_id
     FROM a JOIN (SELECT b.id AS id, b.some_b_column AS some_b_column
index 2d12f775135d5cdc9824ffc20fb1871506d1c003..cd36384c559396ff635b29f003095a16019c566f 100644 (file)
@@ -183,7 +183,7 @@ that is, from the ``EmailAddress`` class directly:
     from sqlalchemy import select
     session = Session()
 
-    {sql}address = address = session.scalars(
+    {sql}address = session.scalars(
         select(EmailAddress).where(EmailAddress.email == 'address@example.com'
     ).one()
     SELECT address.email AS address_email, address.id AS address_id
@@ -241,7 +241,7 @@ attribute, a SQL function is rendered which produces the same effect:
 
 .. sourcecode:: python+sql
 
-    {sql}address = session.scalars(select(EmailAddress).where(EmailAddress.email == 'address')).one())
+    {sql}address = session.scalars(select(EmailAddress).where(EmailAddress.email == 'address')).one()
     SELECT address.email AS address_email, address.id AS address_id
     FROM address
     WHERE substr(address.email, ?, length(address.email) - ?) = ?