]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
Ensure order in doctest of core/tutorial.rst
authorFederico Caselli <cfederico87@gmail.com>
Sun, 10 May 2020 12:37:21 +0000 (14:37 +0200)
committerFederico Caselli <cfederico87@gmail.com>
Sun, 10 May 2020 12:38:55 +0000 (14:38 +0200)
Fix doctest error caused by the missing order by clause in the
tests introduced in Ia1bbe3248b4f7c74fbee06fedf76a6ce94cd28a6

Change-Id: I55b45690879ebbaa57bc62765fcdab06f5e9c6f3
(cherry picked from commit 265ee8e39686b55f392feee94db72a7166f93d34)

doc/build/core/tutorial.rst

index e665c96308f8a3b8e60bf94f4180fc0caf19e7e7..7da8ea8778dc37ec8bc1e94ef0e2869214ee65f5 100644 (file)
@@ -1271,7 +1271,7 @@ typically acquires using the :meth:`_expression.Select.cte` method on a
 .. sourcecode:: pycon+sql
 
     >>> users_cte = select([users.c.id, users.c.name]).where(users.c.name == 'wendy').cte()
-    >>> stmt = select([addresses]).where(addresses.c.user_id == users_cte.c.id)
+    >>> stmt = select([addresses]).where(addresses.c.user_id == users_cte.c.id).order_by(addresses.c.id)
     >>> conn.execute(stmt).fetchall()
     {opensql}WITH anon_1 AS
     (SELECT users.id AS id, users.name AS name
@@ -1279,7 +1279,7 @@ typically acquires using the :meth:`_expression.Select.cte` method on a
     WHERE users.name = ?)
      SELECT addresses.id, addresses.user_id, addresses.email_address
     FROM addresses, anon_1
-    WHERE addresses.user_id = anon_1.id
+    WHERE addresses.user_id = anon_1.id ORDER BY addresses.id
     ('wendy',)
     {stop}[(3, 2, 'www@www.org'), (4, 2, 'wendy@aol.com')]
 
@@ -1308,7 +1308,7 @@ this form looks like:
     >>> users_cte = select([users.c.id, users.c.name]).cte(recursive=True)
     >>> users_recursive = users_cte.alias()
     >>> users_cte = users_cte.union(select([users.c.id, users.c.name]).where(users.c.id > users_recursive.c.id))
-    >>> stmt = select([addresses]).where(addresses.c.user_id == users_cte.c.id)
+    >>> stmt = select([addresses]).where(addresses.c.user_id == users_cte.c.id).order_by(addresses.c.id)
     >>> conn.execute(stmt).fetchall()
     {opensql}WITH RECURSIVE anon_1(id, name) AS
     (SELECT users.id AS id, users.name AS name
@@ -1317,7 +1317,7 @@ this form looks like:
     WHERE users.id > anon_2.id)
      SELECT addresses.id, addresses.user_id, addresses.email_address
     FROM addresses, anon_1
-    WHERE addresses.user_id = anon_1.id
+    WHERE addresses.user_id = anon_1.id ORDER BY addresses.id
     ()
     {stop}[(1, 1, 'jack@yahoo.com'), (2, 1, 'jack@msn.com'), (3, 2, 'www@www.org'), (4, 2, 'wendy@aol.com')]