]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
Modernize tests - select(whereclause)
authorGord Thompson <gord@gordthompson.com>
Sun, 4 Jul 2021 21:56:40 +0000 (15:56 -0600)
committerGord Thompson <gord@gordthompson.com>
Sun, 4 Jul 2021 21:56:40 +0000 (15:56 -0600)
Change-Id: I306cfbea9920b35100e3087dcc21d7ffa6c39c55

19 files changed:
lib/sqlalchemy/testing/suite/test_select.py
lib/sqlalchemy/testing/warnings.py
test/dialect/mysql/test_compiler.py
test/dialect/mysql/test_for_update.py
test/dialect/oracle/test_compiler.py
test/dialect/postgresql/test_compiler.py
test/orm/inheritance/test_selects.py
test/orm/test_bind.py
test/orm/test_deprecations.py
test/orm/test_eager_relations.py
test/orm/test_froms.py
test/orm/test_query.py
test/orm/test_selectin_relations.py
test/orm/test_subquery_relations.py
test/orm/test_unitofwork.py
test/sql/test_operators.py
test/sql/test_query.py
test/sql/test_resultset.py
test/sql/test_selectable.py

index 1605033a023e14f3b3a1bcacbe5e1e073c2b63fa..0a1227e584c3244edaf7c1cc7e0b7d05bb386876 100644 (file)
@@ -1663,7 +1663,7 @@ class IsOrIsNotDistinctFromTest(fixtures.TablesTest):
         )
 
         result = connection.execute(
-            tbl.select(tbl.c.col_a.is_distinct_from(tbl.c.col_b))
+            tbl.select().where(tbl.c.col_a.is_distinct_from(tbl.c.col_b))
         ).fetchall()
         eq_(
             len(result),
@@ -1674,7 +1674,7 @@ class IsOrIsNotDistinctFromTest(fixtures.TablesTest):
             1 if expected_row_count_for_is == 0 else 0
         )
         result = connection.execute(
-            tbl.select(tbl.c.col_a.is_not_distinct_from(tbl.c.col_b))
+            tbl.select().where(tbl.c.col_a.is_not_distinct_from(tbl.c.col_b))
         ).fetchall()
         eq_(
             len(result),
index df0e5aa5e515c4b7b7b3c2c7fa96e46ad3ab84e0..8f9273b308f81714868693f4ecd76c08e9d3b390 100644 (file)
@@ -65,16 +65,9 @@ def setup_filters():
     # be "error" however for  I98b8defdf7c37b818b3824d02f7668e3f5f31c94
     # we are moving one at a time
     for msg in [
-        #
-        # Core execution
-        #
-        #        r".*DefaultGenerator.execute\(\)",
-        #
-        #
         #
         # Core SQL constructs
         #
-        r"The FromClause\.select\(\).whereclause parameter is deprecated",
         r"Set functions such as union\(\), union_all\(\), extract\(\),",
         r"The legacy calling style of select\(\) is deprecated and will be "
         "removed",
index b0a6ee333cfbae4e0d5078c8730016e67b25efa9..6929d7d4e889495ff7679404c7a609fc82ce4cd7 100644 (file)
@@ -426,7 +426,9 @@ class CompileTest(fixtures.TestBase, AssertsCompiledSQL):
         )
 
         self.assert_compile(
-            table1.select(table1.c.myid == 7).with_for_update(of=table1),
+            table1.select()
+            .where(table1.c.myid == 7)
+            .with_for_update(of=table1),
             "SELECT mytable.myid, mytable.name, mytable.description "
             "FROM mytable WHERE mytable.myid = %s "
             "FOR UPDATE",
index 2f51747f514c905a5dc46a570dfd80bd02ae3731..1708c075e9ddc69b6ee7b32c1970a3d4bc461975 100644 (file)
@@ -191,25 +191,27 @@ class MySQLForUpdateCompileTest(fixtures.TestBase, AssertsCompiledSQL):
 
     def test_for_update_basic(self):
         self.assert_compile(
-            self.table1.select(self.table1.c.myid == 7).with_for_update(),
+            self.table1.select()
+            .where(self.table1.c.myid == 7)
+            .with_for_update(),
             "SELECT mytable.myid, mytable.name, mytable.description "
             "FROM mytable WHERE mytable.myid = %s FOR UPDATE",
         )
 
     def test_for_update_read(self):
         self.assert_compile(
-            self.table1.select(self.table1.c.myid == 7).with_for_update(
-                read=True
-            ),
+            self.table1.select()
+            .where(self.table1.c.myid == 7)
+            .with_for_update(read=True),
             "SELECT mytable.myid, mytable.name, mytable.description "
             "FROM mytable WHERE mytable.myid = %s LOCK IN SHARE MODE",
         )
 
     def test_for_update_skip_locked(self):
         self.assert_compile(
-            self.table1.select(self.table1.c.myid == 7).with_for_update(
-                skip_locked=True
-            ),
+            self.table1.select()
+            .where(self.table1.c.myid == 7)
+            .with_for_update(skip_locked=True),
             "SELECT mytable.myid, mytable.name, mytable.description "
             "FROM mytable WHERE mytable.myid = %s "
             "FOR UPDATE SKIP LOCKED",
@@ -217,9 +219,9 @@ class MySQLForUpdateCompileTest(fixtures.TestBase, AssertsCompiledSQL):
 
     def test_for_update_read_and_skip_locked(self):
         self.assert_compile(
-            self.table1.select(self.table1.c.myid == 7).with_for_update(
-                read=True, skip_locked=True
-            ),
+            self.table1.select()
+            .where(self.table1.c.myid == 7)
+            .with_for_update(read=True, skip_locked=True),
             "SELECT mytable.myid, mytable.name, mytable.description "
             "FROM mytable WHERE mytable.myid = %s "
             "LOCK IN SHARE MODE SKIP LOCKED",
@@ -227,9 +229,9 @@ class MySQLForUpdateCompileTest(fixtures.TestBase, AssertsCompiledSQL):
 
     def test_for_update_nowait(self):
         self.assert_compile(
-            self.table1.select(self.table1.c.myid == 7).with_for_update(
-                nowait=True
-            ),
+            self.table1.select()
+            .where(self.table1.c.myid == 7)
+            .with_for_update(nowait=True),
             "SELECT mytable.myid, mytable.name, mytable.description "
             "FROM mytable WHERE mytable.myid = %s "
             "FOR UPDATE NOWAIT",
@@ -237,9 +239,9 @@ class MySQLForUpdateCompileTest(fixtures.TestBase, AssertsCompiledSQL):
 
     def test_for_update_read_and_nowait(self):
         self.assert_compile(
-            self.table1.select(self.table1.c.myid == 7).with_for_update(
-                read=True, nowait=True
-            ),
+            self.table1.select()
+            .where(self.table1.c.myid == 7)
+            .with_for_update(read=True, nowait=True),
             "SELECT mytable.myid, mytable.name, mytable.description "
             "FROM mytable WHERE mytable.myid = %s "
             "LOCK IN SHARE MODE NOWAIT",
@@ -247,9 +249,9 @@ class MySQLForUpdateCompileTest(fixtures.TestBase, AssertsCompiledSQL):
 
     def test_for_update_of_nowait(self):
         self.assert_compile(
-            self.table1.select(self.table1.c.myid == 7).with_for_update(
-                of=self.table1, nowait=True
-            ),
+            self.table1.select()
+            .where(self.table1.c.myid == 7)
+            .with_for_update(of=self.table1, nowait=True),
             "SELECT mytable.myid, mytable.name, mytable.description "
             "FROM mytable WHERE mytable.myid = %s "
             "FOR UPDATE OF mytable NOWAIT",
@@ -258,9 +260,9 @@ class MySQLForUpdateCompileTest(fixtures.TestBase, AssertsCompiledSQL):
 
     def test_for_update_of_basic(self):
         self.assert_compile(
-            self.table1.select(self.table1.c.myid == 7).with_for_update(
-                of=self.table1
-            ),
+            self.table1.select()
+            .where(self.table1.c.myid == 7)
+            .with_for_update(of=self.table1),
             "SELECT mytable.myid, mytable.name, mytable.description "
             "FROM mytable WHERE mytable.myid = %s "
             "FOR UPDATE OF mytable",
@@ -269,9 +271,9 @@ class MySQLForUpdateCompileTest(fixtures.TestBase, AssertsCompiledSQL):
 
     def test_for_update_of_skip_locked(self):
         self.assert_compile(
-            self.table1.select(self.table1.c.myid == 7).with_for_update(
-                of=self.table1, skip_locked=True
-            ),
+            self.table1.select()
+            .where(self.table1.c.myid == 7)
+            .with_for_update(of=self.table1, skip_locked=True),
             "SELECT mytable.myid, mytable.name, mytable.description "
             "FROM mytable WHERE mytable.myid = %s "
             "FOR UPDATE OF mytable SKIP LOCKED",
@@ -295,9 +297,9 @@ class MySQLForUpdateCompileTest(fixtures.TestBase, AssertsCompiledSQL):
     def test_for_update_of_column_list_aliased(self):
         ta = self.table1.alias()
         self.assert_compile(
-            ta.select(ta.c.myid == 7).with_for_update(
-                of=[ta.c.myid, ta.c.name]
-            ),
+            ta.select()
+            .where(ta.c.myid == 7)
+            .with_for_update(of=[ta.c.myid, ta.c.name]),
             "SELECT mytable_1.myid, mytable_1.name, mytable_1.description "
             "FROM mytable AS mytable_1 "
             "WHERE mytable_1.myid = %s FOR UPDATE OF mytable_1",
@@ -325,9 +327,9 @@ class MySQLForUpdateCompileTest(fixtures.TestBase, AssertsCompiledSQL):
 
     def test_for_update_of_read_nowait(self):
         self.assert_compile(
-            self.table1.select(self.table1.c.myid == 7).with_for_update(
-                read=True, of=self.table1, nowait=True
-            ),
+            self.table1.select()
+            .where(self.table1.c.myid == 7)
+            .with_for_update(read=True, of=self.table1, nowait=True),
             "SELECT mytable.myid, mytable.name, mytable.description "
             "FROM mytable WHERE mytable.myid = %s "
             "LOCK IN SHARE MODE OF mytable NOWAIT",
@@ -336,9 +338,9 @@ class MySQLForUpdateCompileTest(fixtures.TestBase, AssertsCompiledSQL):
 
     def test_for_update_of_read_skip_locked(self):
         self.assert_compile(
-            self.table1.select(self.table1.c.myid == 7).with_for_update(
-                read=True, of=self.table1, skip_locked=True
-            ),
+            self.table1.select()
+            .where(self.table1.c.myid == 7)
+            .with_for_update(read=True, of=self.table1, skip_locked=True),
             "SELECT mytable.myid, mytable.name, mytable.description "
             "FROM mytable WHERE mytable.myid = %s "
             "LOCK IN SHARE MODE OF mytable SKIP LOCKED",
@@ -347,7 +349,9 @@ class MySQLForUpdateCompileTest(fixtures.TestBase, AssertsCompiledSQL):
 
     def test_for_update_of_read_nowait_column_list(self):
         self.assert_compile(
-            self.table1.select(self.table1.c.myid == 7).with_for_update(
+            self.table1.select()
+            .where(self.table1.c.myid == 7)
+            .with_for_update(
                 read=True,
                 of=[self.table1.c.myid, self.table1.c.name],
                 nowait=True,
@@ -360,9 +364,9 @@ class MySQLForUpdateCompileTest(fixtures.TestBase, AssertsCompiledSQL):
 
     def test_for_update_of_read(self):
         self.assert_compile(
-            self.table1.select(self.table1.c.myid == 7).with_for_update(
-                read=True, of=self.table1
-            ),
+            self.table1.select()
+            .where(self.table1.c.myid == 7)
+            .with_for_update(read=True, of=self.table1),
             "SELECT mytable.myid, mytable.name, mytable.description "
             "FROM mytable WHERE mytable.myid = %s "
             "LOCK IN SHARE MODE OF mytable",
@@ -371,9 +375,9 @@ class MySQLForUpdateCompileTest(fixtures.TestBase, AssertsCompiledSQL):
 
     def test_for_update_textual_of(self):
         self.assert_compile(
-            self.table1.select(self.table1.c.myid == 7).with_for_update(
-                of=text("mytable")
-            ),
+            self.table1.select()
+            .where(self.table1.c.myid == 7)
+            .with_for_update(of=text("mytable")),
             "SELECT mytable.myid, mytable.name, mytable.description "
             "FROM mytable WHERE mytable.myid = %s "
             "FOR UPDATE OF mytable",
@@ -381,9 +385,9 @@ class MySQLForUpdateCompileTest(fixtures.TestBase, AssertsCompiledSQL):
         )
 
         self.assert_compile(
-            self.table1.select(self.table1.c.myid == 7).with_for_update(
-                of=literal_column("mytable")
-            ),
+            self.table1.select()
+            .where(self.table1.c.myid == 7)
+            .with_for_update(of=literal_column("mytable")),
             "SELECT mytable.myid, mytable.name, mytable.description "
             "FROM mytable WHERE mytable.myid = %s "
             "FOR UPDATE OF mytable",
index 2bbc14e99a05e4cbd184cd0a0665a5500bbac478..e41a770ed493b851898f627baeac6327ad27c02e 100644 (file)
@@ -379,46 +379,50 @@ class CompileTest(fixtures.TestBase, AssertsCompiledSQL):
         )
 
         self.assert_compile(
-            table1.select(table1.c.myid == 7).with_for_update(),
+            table1.select().where(table1.c.myid == 7).with_for_update(),
             "SELECT mytable.myid, mytable.name, mytable.description "
             "FROM mytable WHERE mytable.myid = :myid_1 FOR UPDATE",
         )
 
         self.assert_compile(
-            table1.select(table1.c.myid == 7).with_for_update(
-                of=table1.c.myid
-            ),
+            table1.select()
+            .where(table1.c.myid == 7)
+            .with_for_update(of=table1.c.myid),
             "SELECT mytable.myid, mytable.name, mytable.description "
             "FROM mytable WHERE mytable.myid = :myid_1 "
             "FOR UPDATE OF mytable.myid",
         )
 
         self.assert_compile(
-            table1.select(table1.c.myid == 7).with_for_update(nowait=True),
+            table1.select()
+            .where(table1.c.myid == 7)
+            .with_for_update(nowait=True),
             "SELECT mytable.myid, mytable.name, mytable.description "
             "FROM mytable WHERE mytable.myid = :myid_1 FOR UPDATE NOWAIT",
         )
 
         self.assert_compile(
-            table1.select(table1.c.myid == 7).with_for_update(
-                nowait=True, of=table1.c.myid
-            ),
+            table1.select()
+            .where(table1.c.myid == 7)
+            .with_for_update(nowait=True, of=table1.c.myid),
             "SELECT mytable.myid, mytable.name, mytable.description "
             "FROM mytable WHERE mytable.myid = :myid_1 "
             "FOR UPDATE OF mytable.myid NOWAIT",
         )
 
         self.assert_compile(
-            table1.select(table1.c.myid == 7).with_for_update(
-                nowait=True, of=[table1.c.myid, table1.c.name]
-            ),
+            table1.select()
+            .where(table1.c.myid == 7)
+            .with_for_update(nowait=True, of=[table1.c.myid, table1.c.name]),
             "SELECT mytable.myid, mytable.name, mytable.description "
             "FROM mytable WHERE mytable.myid = :myid_1 FOR UPDATE OF "
             "mytable.myid, mytable.name NOWAIT",
         )
 
         self.assert_compile(
-            table1.select(table1.c.myid == 7).with_for_update(
+            table1.select()
+            .where(table1.c.myid == 7)
+            .with_for_update(
                 skip_locked=True, of=[table1.c.myid, table1.c.name]
             ),
             "SELECT mytable.myid, mytable.name, mytable.description "
@@ -428,25 +432,27 @@ class CompileTest(fixtures.TestBase, AssertsCompiledSQL):
 
         # key_share has no effect
         self.assert_compile(
-            table1.select(table1.c.myid == 7).with_for_update(key_share=True),
+            table1.select()
+            .where(table1.c.myid == 7)
+            .with_for_update(key_share=True),
             "SELECT mytable.myid, mytable.name, mytable.description "
             "FROM mytable WHERE mytable.myid = :myid_1 FOR UPDATE",
         )
 
         # read has no effect
         self.assert_compile(
-            table1.select(table1.c.myid == 7).with_for_update(
-                read=True, key_share=True
-            ),
+            table1.select()
+            .where(table1.c.myid == 7)
+            .with_for_update(read=True, key_share=True),
             "SELECT mytable.myid, mytable.name, mytable.description "
             "FROM mytable WHERE mytable.myid = :myid_1 FOR UPDATE",
         )
 
         ta = table1.alias()
         self.assert_compile(
-            ta.select(ta.c.myid == 7).with_for_update(
-                of=[ta.c.myid, ta.c.name]
-            ),
+            ta.select()
+            .where(ta.c.myid == 7)
+            .with_for_update(of=[ta.c.myid, ta.c.name]),
             "SELECT mytable_1.myid, mytable_1.name, mytable_1.description "
             "FROM mytable mytable_1 "
             "WHERE mytable_1.myid = :myid_1 FOR UPDATE OF "
@@ -455,18 +461,18 @@ class CompileTest(fixtures.TestBase, AssertsCompiledSQL):
 
         # ensure of=text() for of works
         self.assert_compile(
-            table1.select(table1.c.myid == 7).with_for_update(
-                read=True, of=text("table1")
-            ),
+            table1.select()
+            .where(table1.c.myid == 7)
+            .with_for_update(read=True, of=text("table1")),
             "SELECT mytable.myid, mytable.name, mytable.description "
             "FROM mytable WHERE mytable.myid = :myid_1 FOR UPDATE OF table1",
         )
 
         # ensure of=literal_column() for of works
         self.assert_compile(
-            table1.select(table1.c.myid == 7).with_for_update(
-                read=True, of=literal_column("table1")
-            ),
+            table1.select()
+            .where(table1.c.myid == 7)
+            .with_for_update(read=True, of=literal_column("table1")),
             "SELECT mytable.myid, mytable.name, mytable.description "
             "FROM mytable WHERE mytable.myid = :myid_1 FOR UPDATE OF table1",
         )
index e48de9d21d7411f08e890e8aacdad5078a450967..d75030ee0c318c82dfed1d7ff27093d911368c8b 100644 (file)
@@ -1034,87 +1034,93 @@ class CompileTest(fixtures.TestBase, AssertsCompiledSQL):
         )
 
         self.assert_compile(
-            table1.select(table1.c.myid == 7).with_for_update(),
+            table1.select().where(table1.c.myid == 7).with_for_update(),
             "SELECT mytable.myid, mytable.name, mytable.description "
             "FROM mytable WHERE mytable.myid = %(myid_1)s FOR UPDATE",
         )
 
         self.assert_compile(
-            table1.select(table1.c.myid == 7).with_for_update(nowait=True),
+            table1.select()
+            .where(table1.c.myid == 7)
+            .with_for_update(nowait=True),
             "SELECT mytable.myid, mytable.name, mytable.description "
             "FROM mytable WHERE mytable.myid = %(myid_1)s FOR UPDATE NOWAIT",
         )
 
         self.assert_compile(
-            table1.select(table1.c.myid == 7).with_for_update(
-                skip_locked=True
-            ),
+            table1.select()
+            .where(table1.c.myid == 7)
+            .with_for_update(skip_locked=True),
             "SELECT mytable.myid, mytable.name, mytable.description "
             "FROM mytable WHERE mytable.myid = %(myid_1)s "
             "FOR UPDATE SKIP LOCKED",
         )
 
         self.assert_compile(
-            table1.select(table1.c.myid == 7).with_for_update(read=True),
+            table1.select()
+            .where(table1.c.myid == 7)
+            .with_for_update(read=True),
             "SELECT mytable.myid, mytable.name, mytable.description "
             "FROM mytable WHERE mytable.myid = %(myid_1)s FOR SHARE",
         )
 
         self.assert_compile(
-            table1.select(table1.c.myid == 7).with_for_update(
-                read=True, nowait=True
-            ),
+            table1.select()
+            .where(table1.c.myid == 7)
+            .with_for_update(read=True, nowait=True),
             "SELECT mytable.myid, mytable.name, mytable.description "
             "FROM mytable WHERE mytable.myid = %(myid_1)s FOR SHARE NOWAIT",
         )
 
         self.assert_compile(
-            table1.select(table1.c.myid == 7).with_for_update(
-                key_share=True, nowait=True
-            ),
+            table1.select()
+            .where(table1.c.myid == 7)
+            .with_for_update(key_share=True, nowait=True),
             "SELECT mytable.myid, mytable.name, mytable.description "
             "FROM mytable WHERE mytable.myid = %(myid_1)s "
             "FOR NO KEY UPDATE NOWAIT",
         )
 
         self.assert_compile(
-            table1.select(table1.c.myid == 7).with_for_update(
-                key_share=True, read=True, nowait=True
-            ),
+            table1.select()
+            .where(table1.c.myid == 7)
+            .with_for_update(key_share=True, read=True, nowait=True),
             "SELECT mytable.myid, mytable.name, mytable.description "
             "FROM mytable WHERE mytable.myid = %(myid_1)s "
             "FOR KEY SHARE NOWAIT",
         )
 
         self.assert_compile(
-            table1.select(table1.c.myid == 7).with_for_update(
-                read=True, skip_locked=True
-            ),
+            table1.select()
+            .where(table1.c.myid == 7)
+            .with_for_update(read=True, skip_locked=True),
             "SELECT mytable.myid, mytable.name, mytable.description "
             "FROM mytable WHERE mytable.myid = %(myid_1)s "
             "FOR SHARE SKIP LOCKED",
         )
 
         self.assert_compile(
-            table1.select(table1.c.myid == 7).with_for_update(
-                of=table1.c.myid
-            ),
+            table1.select()
+            .where(table1.c.myid == 7)
+            .with_for_update(of=table1.c.myid),
             "SELECT mytable.myid, mytable.name, mytable.description "
             "FROM mytable WHERE mytable.myid = %(myid_1)s "
             "FOR UPDATE OF mytable",
         )
 
         self.assert_compile(
-            table1.select(table1.c.myid == 7).with_for_update(
-                read=True, nowait=True, of=table1
-            ),
+            table1.select()
+            .where(table1.c.myid == 7)
+            .with_for_update(read=True, nowait=True, of=table1),
             "SELECT mytable.myid, mytable.name, mytable.description "
             "FROM mytable WHERE mytable.myid = %(myid_1)s "
             "FOR SHARE OF mytable NOWAIT",
         )
 
         self.assert_compile(
-            table1.select(table1.c.myid == 7).with_for_update(
+            table1.select()
+            .where(table1.c.myid == 7)
+            .with_for_update(
                 key_share=True, read=True, nowait=True, of=table1
             ),
             "SELECT mytable.myid, mytable.name, mytable.description "
@@ -1123,16 +1129,18 @@ class CompileTest(fixtures.TestBase, AssertsCompiledSQL):
         )
 
         self.assert_compile(
-            table1.select(table1.c.myid == 7).with_for_update(
-                read=True, nowait=True, of=table1.c.myid
-            ),
+            table1.select()
+            .where(table1.c.myid == 7)
+            .with_for_update(read=True, nowait=True, of=table1.c.myid),
             "SELECT mytable.myid, mytable.name, mytable.description "
             "FROM mytable WHERE mytable.myid = %(myid_1)s "
             "FOR SHARE OF mytable NOWAIT",
         )
 
         self.assert_compile(
-            table1.select(table1.c.myid == 7).with_for_update(
+            table1.select()
+            .where(table1.c.myid == 7)
+            .with_for_update(
                 read=True, nowait=True, of=[table1.c.myid, table1.c.name]
             ),
             "SELECT mytable.myid, mytable.name, mytable.description "
@@ -1141,7 +1149,9 @@ class CompileTest(fixtures.TestBase, AssertsCompiledSQL):
         )
 
         self.assert_compile(
-            table1.select(table1.c.myid == 7).with_for_update(
+            table1.select()
+            .where(table1.c.myid == 7)
+            .with_for_update(
                 read=True,
                 skip_locked=True,
                 of=[table1.c.myid, table1.c.name],
@@ -1153,7 +1163,9 @@ class CompileTest(fixtures.TestBase, AssertsCompiledSQL):
         )
 
         self.assert_compile(
-            table1.select(table1.c.myid == 7).with_for_update(
+            table1.select()
+            .where(table1.c.myid == 7)
+            .with_for_update(
                 skip_locked=True, of=[table1.c.myid, table1.c.name]
             ),
             "SELECT mytable.myid, mytable.name, mytable.description "
@@ -1162,7 +1174,9 @@ class CompileTest(fixtures.TestBase, AssertsCompiledSQL):
         )
 
         self.assert_compile(
-            table1.select(table1.c.myid == 7).with_for_update(
+            table1.select()
+            .where(table1.c.myid == 7)
+            .with_for_update(
                 read=True, skip_locked=True, of=[table1.c.myid, table1.c.name]
             ),
             "SELECT mytable.myid, mytable.name, mytable.description "
@@ -1171,7 +1185,9 @@ class CompileTest(fixtures.TestBase, AssertsCompiledSQL):
         )
 
         self.assert_compile(
-            table1.select(table1.c.myid == 7).with_for_update(
+            table1.select()
+            .where(table1.c.myid == 7)
+            .with_for_update(
                 key_share=True, nowait=True, of=[table1.c.myid, table1.c.name]
             ),
             "SELECT mytable.myid, mytable.name, mytable.description "
@@ -1180,7 +1196,9 @@ class CompileTest(fixtures.TestBase, AssertsCompiledSQL):
         )
 
         self.assert_compile(
-            table1.select(table1.c.myid == 7).with_for_update(
+            table1.select()
+            .where(table1.c.myid == 7)
+            .with_for_update(
                 key_share=True,
                 skip_locked=True,
                 of=[table1.c.myid, table1.c.name],
@@ -1191,7 +1209,9 @@ class CompileTest(fixtures.TestBase, AssertsCompiledSQL):
         )
 
         self.assert_compile(
-            table1.select(table1.c.myid == 7).with_for_update(
+            table1.select()
+            .where(table1.c.myid == 7)
+            .with_for_update(
                 key_share=True, of=[table1.c.myid, table1.c.name]
             ),
             "SELECT mytable.myid, mytable.name, mytable.description "
@@ -1200,52 +1220,54 @@ class CompileTest(fixtures.TestBase, AssertsCompiledSQL):
         )
 
         self.assert_compile(
-            table1.select(table1.c.myid == 7).with_for_update(key_share=True),
+            table1.select()
+            .where(table1.c.myid == 7)
+            .with_for_update(key_share=True),
             "SELECT mytable.myid, mytable.name, mytable.description "
             "FROM mytable WHERE mytable.myid = %(myid_1)s "
             "FOR NO KEY UPDATE",
         )
 
         self.assert_compile(
-            table1.select(table1.c.myid == 7).with_for_update(
-                read=True, key_share=True
-            ),
+            table1.select()
+            .where(table1.c.myid == 7)
+            .with_for_update(read=True, key_share=True),
             "SELECT mytable.myid, mytable.name, mytable.description "
             "FROM mytable WHERE mytable.myid = %(myid_1)s "
             "FOR KEY SHARE",
         )
 
         self.assert_compile(
-            table1.select(table1.c.myid == 7).with_for_update(
-                read=True, key_share=True, of=table1
-            ),
+            table1.select()
+            .where(table1.c.myid == 7)
+            .with_for_update(read=True, key_share=True, of=table1),
             "SELECT mytable.myid, mytable.name, mytable.description "
             "FROM mytable WHERE mytable.myid = %(myid_1)s "
             "FOR KEY SHARE OF mytable",
         )
 
         self.assert_compile(
-            table1.select(table1.c.myid == 7).with_for_update(
-                read=True, of=table1
-            ),
+            table1.select()
+            .where(table1.c.myid == 7)
+            .with_for_update(read=True, of=table1),
             "SELECT mytable.myid, mytable.name, mytable.description "
             "FROM mytable WHERE mytable.myid = %(myid_1)s "
             "FOR SHARE OF mytable",
         )
 
         self.assert_compile(
-            table1.select(table1.c.myid == 7).with_for_update(
-                read=True, key_share=True, skip_locked=True
-            ),
+            table1.select()
+            .where(table1.c.myid == 7)
+            .with_for_update(read=True, key_share=True, skip_locked=True),
             "SELECT mytable.myid, mytable.name, mytable.description "
             "FROM mytable WHERE mytable.myid = %(myid_1)s "
             "FOR KEY SHARE SKIP LOCKED",
         )
 
         self.assert_compile(
-            table1.select(table1.c.myid == 7).with_for_update(
-                key_share=True, skip_locked=True
-            ),
+            table1.select()
+            .where(table1.c.myid == 7)
+            .with_for_update(key_share=True, skip_locked=True),
             "SELECT mytable.myid, mytable.name, mytable.description "
             "FROM mytable WHERE mytable.myid = %(myid_1)s "
             "FOR NO KEY UPDATE SKIP LOCKED",
@@ -1253,9 +1275,9 @@ class CompileTest(fixtures.TestBase, AssertsCompiledSQL):
 
         ta = table1.alias()
         self.assert_compile(
-            ta.select(ta.c.myid == 7).with_for_update(
-                of=[ta.c.myid, ta.c.name]
-            ),
+            ta.select()
+            .where(ta.c.myid == 7)
+            .with_for_update(of=[ta.c.myid, ta.c.name]),
             "SELECT mytable_1.myid, mytable_1.name, mytable_1.description "
             "FROM mytable AS mytable_1 "
             "WHERE mytable_1.myid = %(myid_1)s FOR UPDATE OF mytable_1",
@@ -1264,7 +1286,9 @@ class CompileTest(fixtures.TestBase, AssertsCompiledSQL):
         table2 = table("table2", column("mytable_id"))
         join = table2.join(table1, table2.c.mytable_id == table1.c.myid)
         self.assert_compile(
-            join.select(table2.c.mytable_id == 7).with_for_update(of=[join]),
+            join.select()
+            .where(table2.c.mytable_id == 7)
+            .with_for_update(of=[join]),
             "SELECT table2.mytable_id, "
             "mytable.myid, mytable.name, mytable.description "
             "FROM table2 "
@@ -1275,7 +1299,9 @@ class CompileTest(fixtures.TestBase, AssertsCompiledSQL):
 
         join = table2.join(ta, table2.c.mytable_id == ta.c.myid)
         self.assert_compile(
-            join.select(table2.c.mytable_id == 7).with_for_update(of=[join]),
+            join.select()
+            .where(table2.c.mytable_id == 7)
+            .with_for_update(of=[join]),
             "SELECT table2.mytable_id, "
             "mytable_1.myid, mytable_1.name, mytable_1.description "
             "FROM table2 "
@@ -1287,9 +1313,9 @@ class CompileTest(fixtures.TestBase, AssertsCompiledSQL):
 
         # ensure of=text() for of works
         self.assert_compile(
-            table1.select(table1.c.myid == 7).with_for_update(
-                of=text("table1")
-            ),
+            table1.select()
+            .where(table1.c.myid == 7)
+            .with_for_update(of=text("table1")),
             "SELECT mytable.myid, mytable.name, mytable.description "
             "FROM mytable WHERE mytable.myid = %(myid_1)s "
             "FOR UPDATE OF table1",
@@ -1297,9 +1323,9 @@ class CompileTest(fixtures.TestBase, AssertsCompiledSQL):
 
         # ensure literal_column of works
         self.assert_compile(
-            table1.select(table1.c.myid == 7).with_for_update(
-                of=literal_column("table1")
-            ),
+            table1.select()
+            .where(table1.c.myid == 7)
+            .with_for_update(of=literal_column("table1")),
             "SELECT mytable.myid, mytable.name, mytable.description "
             "FROM mytable WHERE mytable.myid = %(myid_1)s "
             "FOR UPDATE OF table1",
@@ -1312,7 +1338,9 @@ class CompileTest(fixtures.TestBase, AssertsCompiledSQL):
         )
 
         self.assert_compile(
-            table1.select(table1.c.myid == 7).with_for_update(of=table1),
+            table1.select()
+            .where(table1.c.myid == 7)
+            .with_for_update(of=table1),
             "SELECT testschema.mytable.myid, testschema.mytable.name "
             "FROM testschema.mytable "
             "WHERE testschema.mytable.myid = %(myid_1)s "
index 24297dd0ebc8890a20e94733b00a00021de71c6f..4f6c4a8bd402bb0d7aa5c218176d076f61ac8968 100644 (file)
@@ -21,8 +21,8 @@ class InheritingSelectablesTest(fixtures.MappedTest):
             Column("b", String(30), nullable=0),
         )
 
-        cls.tables.bar = foo.select(foo.c.b == "bar").alias("bar")
-        cls.tables.baz = foo.select(foo.c.b == "baz").alias("baz")
+        cls.tables.bar = foo.select().where(foo.c.b == "bar").alias("bar")
+        cls.tables.baz = foo.select().where(foo.c.b == "baz").alias("baz")
 
     def test_load(self, connection):
         foo, bar, baz = self.tables.foo, self.tables.bar, self.tables.baz
index f448e2c529d56ee7e0da2f559f8e441298f55598..f584f22aea492ceeef07ea8864a8cc543ecfff66 100644 (file)
@@ -73,13 +73,15 @@ class BindIntegrationTest(_fixtures.FixtureTest):
         sess.execute(users_unbound.insert(), params=dict(id=2, name="jack"))
         eq_(
             sess.execute(
-                users_unbound.select(users_unbound.c.id == 2)
+                users_unbound.select().where(users_unbound.c.id == 2)
             ).fetchall(),
             [(2, "jack")],
         )
 
         eq_(
-            sess.execute(users_unbound.select(User.id == 2)).fetchall(),
+            sess.execute(
+                users_unbound.select().where(User.id == 2)
+            ).fetchall(),
             [(2, "jack")],
         )
 
@@ -133,13 +135,15 @@ class BindIntegrationTest(_fixtures.FixtureTest):
 
         eq_(
             sess.execute(
-                users_unbound.select(users_unbound.c.id == 2)
+                users_unbound.select().where(users_unbound.c.id == 2)
             ).fetchall(),
             [(2, "jack")],
         )
 
         eq_(
-            sess.execute(users_unbound.select(User.id == 2)).fetchall(),
+            sess.execute(
+                users_unbound.select().where(User.id == 2)
+            ).fetchall(),
             [(2, "jack")],
         )
 
index c7561e8046d74417ba40fcdada21e0676f7dd201..2081f4f0a28fccde0047119d5e8bf81b8c229375 100644 (file)
@@ -506,8 +506,9 @@ class DeprecatedQueryTest(_fixtures.FixtureTest, AssertsCompiledSQL):
         )
 
         query = (
-            users.select(users.c.id == 7)
-            .union(users.select(users.c.id > 7))
+            users.select()
+            .where(users.c.id == 7)
+            .union(users.select().where(users.c.id > 7))
             .alias("ulist")
             .outerjoin(addresses)
             .select(order_by=[text("ulist.id"), addresses.c.id])
@@ -541,8 +542,9 @@ class DeprecatedQueryTest(_fixtures.FixtureTest, AssertsCompiledSQL):
         # the adapter created by contains_eager()
         adalias = addresses.alias()
         query = (
-            users.select(users.c.id == 7)
-            .union(users.select(users.c.id > 7))
+            users.select()
+            .where(users.c.id == 7)
+            .union(users.select().where(users.c.id > 7))
             .alias("ulist")
             .outerjoin(adalias)
             .select(order_by=[text("ulist.id"), adalias.c.id])
@@ -616,7 +618,7 @@ class DeprecatedQueryTest(_fixtures.FixtureTest, AssertsCompiledSQL):
         # mapper(User, users, properties={"addresses": relationship(Address)})
         # mapper(Address, addresses)
 
-        sel = users.select(users.c.id.in_([7, 8]))
+        sel = users.select().where(users.c.id.in_([7, 8]))
         sess = fixture_session()
 
         with self._expect_implicit_subquery():
@@ -693,7 +695,7 @@ class DeprecatedQueryTest(_fixtures.FixtureTest, AssertsCompiledSQL):
         )
 
         sess = fixture_session()
-        sel = users.select(users.c.id.in_([7, 8]))
+        sel = users.select().where(users.c.id.in_([7, 8]))
 
         with self._expect_implicit_subquery():
             eq_(
@@ -718,7 +720,7 @@ class DeprecatedQueryTest(_fixtures.FixtureTest, AssertsCompiledSQL):
     def test_join_no_order_by(self):
         User, users = self.classes.User, self.tables.users
 
-        sel = users.select(users.c.id.in_([7, 8]))
+        sel = users.select().where(users.c.id.in_([7, 8]))
         sess = fixture_session()
 
         with self._expect_implicit_subquery():
@@ -734,7 +736,7 @@ class DeprecatedQueryTest(_fixtures.FixtureTest, AssertsCompiledSQL):
             self.classes.User,
         )
 
-        sel = users.select(users.c.id.in_([7, 8]))
+        sel = users.select().where(users.c.id.in_([7, 8]))
         sess = fixture_session()
 
         def go():
@@ -3297,8 +3299,9 @@ class InstancesTest(QueryTest, AssertsCompiledSQL):
         )
 
         query = (
-            users.select(users.c.id == 7)
-            .union(users.select(users.c.id > 7))
+            users.select()
+            .where(users.c.id == 7)
+            .union(users.select().where(users.c.id > 7))
             .alias("ulist")
             .outerjoin(addresses)
             .select(order_by=[text("ulist.id"), addresses.c.id])
@@ -3746,7 +3749,7 @@ class MixedEntitiesTest(QueryTest, AssertsCompiledSQL):
         with testing.expect_deprecated(r"Query.values?\(\) is deprecated"):
             assert list(sess.query(User).values()) == list()
 
-        sel = users.select(User.id.in_([7, 8])).alias()
+        sel = users.select().where(User.id.in_([7, 8])).alias()
         q = sess.query(User)
         with testing.expect_deprecated(r"Query.values?\(\) is deprecated"):
             q2 = q.select_entity_from(sel).values(User.name)
@@ -3854,7 +3857,7 @@ class MixedEntitiesTest(QueryTest, AssertsCompiledSQL):
         with testing.expect_deprecated(r"Query.values?\(\) is deprecated"):
             assert list(sess.query(User).values()) == list()
 
-        sel = users.select(User.id.in_([7, 8])).alias()
+        sel = users.select().where(User.id.in_([7, 8])).alias()
         q = sess.query(User)
         u2 = aliased(User)
         with testing.expect_deprecated(r"Query.values?\(\) is deprecated"):
index e52af90b910dc7858fbf6dc5a2b3f117056cb2a6..8a41160838641e4c2ff61c26dcf3f708c2ee7543 100644 (file)
@@ -1967,9 +1967,11 @@ class EagerTest(_fixtures.FixtureTest, testing.AssertsCompiledSQL):
             .alias("max_orders_by_user")
         )
 
-        max_orders = orders.select(
-            orders.c.id == max_orders_by_user.c.order_id
-        ).alias("max_orders")
+        max_orders = (
+            orders.select()
+            .where(orders.c.id == max_orders_by_user.c.order_id)
+            .alias("max_orders")
+        )
 
         mapper(Order, orders)
         mapper(
index 5881c54c2abdf1382030c4539c44de09c4e191ac..9496f57bcf78e8ff04eacdc7eefdbe0eb7a9860d 100644 (file)
@@ -1078,8 +1078,9 @@ class InstancesTest(QueryTest, AssertsCompiledSQL):
         )
 
         query = (
-            users.select(users.c.id == 7)
-            .union(users.select(users.c.id > 7))
+            users.select()
+            .where(users.c.id == 7)
+            .union(users.select().where(users.c.id > 7))
             .alias("ulist")
             .outerjoin(addresses)
             .select(order_by=[text("ulist.id"), addresses.c.id])
@@ -1105,8 +1106,9 @@ class InstancesTest(QueryTest, AssertsCompiledSQL):
         )
 
         query = (
-            users.select(users.c.id == 7)
-            .union(users.select(users.c.id > 7))
+            users.select()
+            .where(users.c.id == 7)
+            .union(users.select().where(users.c.id > 7))
             .alias("ulist")
             .outerjoin(addresses)
             .select(order_by=[text("ulist.id"), addresses.c.id])
@@ -1134,8 +1136,9 @@ class InstancesTest(QueryTest, AssertsCompiledSQL):
         )
 
         query = (
-            users.select(users.c.id == 7)
-            .union(users.select(users.c.id > 7))
+            users.select()
+            .where(users.c.id == 7)
+            .union(users.select().where(users.c.id > 7))
             .alias("ulist")
             .outerjoin(addresses)
             .select(order_by=[text("ulist.id"), addresses.c.id])
@@ -1168,8 +1171,9 @@ class InstancesTest(QueryTest, AssertsCompiledSQL):
         # the adapter created by contains_eager()
         adalias = addresses.alias()
         query = (
-            users.select(users.c.id == 7)
-            .union(users.select(users.c.id > 7))
+            users.select()
+            .where(users.c.id == 7)
+            .union(users.select().where(users.c.id > 7))
             .alias("ulist")
             .outerjoin(adalias)
             .select(order_by=[text("ulist.id"), adalias.c.id])
@@ -1704,7 +1708,7 @@ class MixedEntitiesTest(QueryTest, AssertsCompiledSQL):
         )
 
         sess = fixture_session()
-        sel = users.select(User.id.in_([7, 8])).alias()
+        sel = users.select().where(User.id.in_([7, 8])).alias()
         q = sess.query(User.name)
         q2 = q.select_entity_from(sel).all()
         eq_(list(q2), [("jack",), ("ed",)])
@@ -2653,7 +2657,7 @@ class SelectFromTest(QueryTest, AssertsCompiledSQL):
         mapper(User, users, properties={"addresses": relationship(Address)})
         mapper(Address, addresses)
 
-        sel = users.select(users.c.id.in_([7, 8])).alias()
+        sel = users.select().where(users.c.id.in_([7, 8])).alias()
         sess = fixture_session()
 
         eq_(
@@ -2879,7 +2883,7 @@ class SelectFromTest(QueryTest, AssertsCompiledSQL):
 
         mapper(User, users)
 
-        sel = users.select(users.c.id.in_([7, 8]))
+        sel = users.select().where(users.c.id.in_([7, 8]))
         sess = fixture_session()
 
         eq_(
@@ -2957,7 +2961,7 @@ class SelectFromTest(QueryTest, AssertsCompiledSQL):
         mapper(User, users, properties={"addresses": relationship(Address)})
         mapper(Address, addresses)
 
-        sel = users.select(users.c.id.in_([7, 8]))
+        sel = users.select().where(users.c.id.in_([7, 8]))
         sess = fixture_session()
 
         eq_(
@@ -3069,7 +3073,7 @@ class SelectFromTest(QueryTest, AssertsCompiledSQL):
         mapper(Keyword, keywords)
 
         sess = fixture_session()
-        sel = users.select(users.c.id.in_([7, 8]))
+        sel = users.select().where(users.c.id.in_([7, 8]))
 
         eq_(
             sess.query(User)
@@ -3132,7 +3136,7 @@ class SelectFromTest(QueryTest, AssertsCompiledSQL):
 
         sess = fixture_session()
 
-        sel = users.select(users.c.id.in_([7, 8]))
+        sel = users.select().where(users.c.id.in_([7, 8]))
 
         def go():
             eq_(
@@ -3212,7 +3216,7 @@ class SelectFromTest(QueryTest, AssertsCompiledSQL):
         self.assert_sql_count(testing.db, go, 1)
 
         sess.expunge_all()
-        sel2 = orders.select(orders.c.id.in_([1, 2, 3]))
+        sel2 = orders.select().where(orders.c.id.in_([1, 2, 3]))
         eq_(
             sess.query(Order)
             .select_entity_from(sel2.subquery())
@@ -3244,7 +3248,7 @@ class SelectFromTest(QueryTest, AssertsCompiledSQL):
         )
         mapper(Address, addresses)
 
-        sel = users.select(users.c.id.in_([7, 8]))
+        sel = users.select().where(users.c.id.in_([7, 8]))
         sess = fixture_session()
 
         def go():
index ed705576617dd7313c00812466a45d06a6ae123b..a30d0ef7e65ad0765099706807c9a6ebb6f31874 100644 (file)
@@ -1133,7 +1133,7 @@ class GetTest(QueryTest):
         class SomeUser(object):
             pass
 
-        s = users.select(users.c.id != 12).alias("users")
+        s = users.select().where(users.c.id != 12).alias("users")
         m = mapper(SomeUser, s)
         assert s.primary_key == m.primary_key
 
index 233ca5423d8f644500d132aba60ae206c74badd7..4dbd269996e46505eb294308f6c9c248a4fc248e 100644 (file)
@@ -1344,9 +1344,11 @@ class EagerTest(_fixtures.FixtureTest, testing.AssertsCompiledSQL):
             .alias("max_orders_by_user")
         )
 
-        max_orders = orders.select(
-            orders.c.id == max_orders_by_user.c.order_id
-        ).alias("max_orders")
+        max_orders = (
+            orders.select()
+            .where(orders.c.id == max_orders_by_user.c.order_id)
+            .alias("max_orders")
+        )
 
         mapper(Order, orders)
         mapper(
index 512ec0fe2bffb340fb3b7b0b94d26fef6e1158ac..2115cf4d85f297d00db1ebc503bcdc7fb97a4b51 100644 (file)
@@ -1375,9 +1375,11 @@ class EagerTest(_fixtures.FixtureTest, testing.AssertsCompiledSQL):
             .alias("max_orders_by_user")
         )
 
-        max_orders = orders.select(
-            orders.c.id == max_orders_by_user.c.order_id
-        ).alias("max_orders")
+        max_orders = (
+            orders.select()
+            .where(orders.c.id == max_orders_by_user.c.order_id)
+            .alias("max_orders")
+        )
 
         mapper(Order, orders)
         mapper(
index ff8349fee9725f06545a9592136dce0ab9dc4750..2f2586556dba1cc126fe8742d0a3db8f8a64a3bd 100644 (file)
@@ -1525,14 +1525,13 @@ class OneToManyTest(_fixtures.FixtureTest):
 
         conn = session.connection()
         user_rows = conn.execute(
-            users.select(users.c.id.in_([u.id]))
+            users.select().where(users.c.id.in_([u.id]))
         ).fetchall()
         eq_(list(user_rows[0]), [u.id, "one2manytester"])
 
         address_rows = conn.execute(
-            addresses.select(
+            addresses.select(order_by=[addresses.c.email_address]).where(
                 addresses.c.id.in_([a.id, a2.id]),
-                order_by=[addresses.c.email_address],
             )
         ).fetchall()
         eq_(list(address_rows[0]), [a2.id, u.id, "lala@test.org"])
@@ -1546,7 +1545,7 @@ class OneToManyTest(_fixtures.FixtureTest):
         session.flush()
 
         address_rows = conn.execute(
-            addresses.select(addresses.c.id == addressid)
+            addresses.select().where(addresses.c.id == addressid)
         ).fetchall()
         eq_(list(address_rows[0]), [addressid, userid, "somethingnew@foo.com"])
         self.assert_(u.id == userid and a2.id == addressid)
@@ -2086,11 +2085,11 @@ class SaveTest(_fixtures.FixtureTest):
 
         conn = session.connection()
         user_rows = conn.execute(
-            users.select(users.c.id.in_([u.foo_id]))
+            users.select().where(users.c.id.in_([u.foo_id]))
         ).fetchall()
         eq_(list(user_rows[0]), [u.foo_id, "multitester"])
         address_rows = conn.execute(
-            addresses.select(addresses.c.id.in_([u.id]))
+            addresses.select().where(addresses.c.id.in_([u.id]))
         ).fetchall()
         eq_(list(address_rows[0]), [u.id, u.foo_id, "multi@test.org"])
 
@@ -2099,11 +2098,11 @@ class SaveTest(_fixtures.FixtureTest):
         session.flush()
 
         user_rows = conn.execute(
-            users.select(users.c.id.in_([u.foo_id]))
+            users.select().where(users.c.id.in_([u.foo_id]))
         ).fetchall()
         eq_(list(user_rows[0]), [u.foo_id, "imnew"])
         address_rows = conn.execute(
-            addresses.select(addresses.c.id.in_([u.id]))
+            addresses.select().where(addresses.c.id.in_([u.id]))
         ).fetchall()
         eq_(list(address_rows[0]), [u.id, u.foo_id, "lala@hey.com"])
 
index 43d9133a79b95f4ff05b55eaaaab46604f9c8bea..b2ba7ae7341e777b49beb9d422182789dd3ce515 100644 (file)
@@ -1355,13 +1355,15 @@ class OperatorPrecedenceTest(fixtures.TestBase, testing.AssertsCompiledSQL):
 
     def test_operator_precedence_1(self):
         self.assert_compile(
-            self.table2.select((self.table2.c.field == 5) == None),  # noqa
+            self.table2.select().where(
+                (self.table2.c.field == 5) == None
+            ),  # noqa
             "SELECT op.field FROM op WHERE (op.field = :field_1) IS NULL",
         )
 
     def test_operator_precedence_2(self):
         self.assert_compile(
-            self.table2.select(
+            self.table2.select().where(
                 (self.table2.c.field + 5) == self.table2.c.field
             ),
             "SELECT op.field FROM op WHERE op.field + :field_1 = op.field",
@@ -1369,33 +1371,33 @@ class OperatorPrecedenceTest(fixtures.TestBase, testing.AssertsCompiledSQL):
 
     def test_operator_precedence_3(self):
         self.assert_compile(
-            self.table2.select((self.table2.c.field + 5) * 6),
+            self.table2.select().where((self.table2.c.field + 5) * 6),
             "SELECT op.field FROM op WHERE (op.field + :field_1) * :param_1",
         )
 
     def test_operator_precedence_4(self):
         self.assert_compile(
-            self.table2.select((self.table2.c.field * 5) + 6),
+            self.table2.select().where((self.table2.c.field * 5) + 6),
             "SELECT op.field FROM op WHERE op.field * :field_1 + :param_1",
         )
 
     def test_operator_precedence_5(self):
         self.assert_compile(
-            self.table2.select(5 + self.table2.c.field.in_([5, 6])),
+            self.table2.select().where(5 + self.table2.c.field.in_([5, 6])),
             "SELECT op.field FROM op WHERE :param_1 + "
             "(op.field IN ([POSTCOMPILE_field_1]))",
         )
 
     def test_operator_precedence_6(self):
         self.assert_compile(
-            self.table2.select((5 + self.table2.c.field).in_([5, 6])),
+            self.table2.select().where((5 + self.table2.c.field).in_([5, 6])),
             "SELECT op.field FROM op WHERE :field_1 + op.field "
             "IN ([POSTCOMPILE_param_1])",
         )
 
     def test_operator_precedence_7(self):
         self.assert_compile(
-            self.table2.select(
+            self.table2.select().where(
                 not_(and_(self.table2.c.field == 5, self.table2.c.field == 7))
             ),
             "SELECT op.field FROM op WHERE NOT "
@@ -1404,26 +1406,28 @@ class OperatorPrecedenceTest(fixtures.TestBase, testing.AssertsCompiledSQL):
 
     def test_operator_precedence_8(self):
         self.assert_compile(
-            self.table2.select(not_(self.table2.c.field == 5)),
+            self.table2.select().where(not_(self.table2.c.field == 5)),
             "SELECT op.field FROM op WHERE op.field != :field_1",
         )
 
     def test_operator_precedence_9(self):
         self.assert_compile(
-            self.table2.select(not_(self.table2.c.field.between(5, 6))),
+            self.table2.select().where(
+                not_(self.table2.c.field.between(5, 6))
+            ),
             "SELECT op.field FROM op WHERE "
             "op.field NOT BETWEEN :field_1 AND :field_2",
         )
 
     def test_operator_precedence_10(self):
         self.assert_compile(
-            self.table2.select(not_(self.table2.c.field) == 5),
+            self.table2.select().where(not_(self.table2.c.field) == 5),
             "SELECT op.field FROM op WHERE (NOT op.field) = :param_1",
         )
 
     def test_operator_precedence_11(self):
         self.assert_compile(
-            self.table2.select(
+            self.table2.select().where(
                 (self.table2.c.field == self.table2.c.field).between(
                     False, True
                 )
@@ -1434,7 +1438,7 @@ class OperatorPrecedenceTest(fixtures.TestBase, testing.AssertsCompiledSQL):
 
     def test_operator_precedence_12(self):
         self.assert_compile(
-            self.table2.select(
+            self.table2.select().where(
                 between(
                     (self.table2.c.field == self.table2.c.field), False, True
                 )
@@ -1445,7 +1449,7 @@ class OperatorPrecedenceTest(fixtures.TestBase, testing.AssertsCompiledSQL):
 
     def test_operator_precedence_13(self):
         self.assert_compile(
-            self.table2.select(
+            self.table2.select().where(
                 self.table2.c.field.match(self.table2.c.field).is_(None)
             ),
             "SELECT op.field FROM op WHERE (op.field MATCH op.field) IS NULL",
@@ -1514,7 +1518,9 @@ class OperatorPrecedenceTest(fixtures.TestBase, testing.AssertsCompiledSQL):
 
     def test_op_operators(self):
         self.assert_compile(
-            self.table1.select(self.table1.c.myid.op("hoho")(12) == 14),
+            self.table1.select().where(
+                self.table1.c.myid.op("hoho")(12) == 14
+            ),
             "SELECT mytable.myid, mytable.name, mytable.description FROM "
             "mytable WHERE (mytable.myid hoho :myid_1) = :param_1",
         )
@@ -2319,7 +2325,7 @@ class NegationTest(fixtures.TestBase, testing.AssertsCompiledSQL):
 
     def test_negate_operators_2(self):
         self.assert_compile(
-            self.table1.select(
+            self.table1.select().where(
                 (self.table1.c.myid != 12) & ~(self.table1.c.name == "john")
             ),
             "SELECT mytable.myid, mytable.name FROM "
@@ -2329,7 +2335,7 @@ class NegationTest(fixtures.TestBase, testing.AssertsCompiledSQL):
 
     def test_negate_operators_3(self):
         self.assert_compile(
-            self.table1.select(
+            self.table1.select().where(
                 (self.table1.c.myid != 12)
                 & ~(self.table1.c.name.between("jack", "john"))
             ),
@@ -2340,7 +2346,7 @@ class NegationTest(fixtures.TestBase, testing.AssertsCompiledSQL):
 
     def test_negate_operators_4(self):
         self.assert_compile(
-            self.table1.select(
+            self.table1.select().where(
                 (self.table1.c.myid != 12)
                 & ~and_(
                     self.table1.c.name == "john",
@@ -2356,7 +2362,7 @@ class NegationTest(fixtures.TestBase, testing.AssertsCompiledSQL):
 
     def test_negate_operators_5(self):
         self.assert_compile(
-            self.table1.select(
+            self.table1.select().where(
                 (self.table1.c.myid != 12) & ~self.table1.c.name
             ),
             "SELECT mytable.myid, mytable.name FROM "
index 14dc397f68bdc9e50630313bfbc68a242fb78065..b3d728ab36147ecf58b8741a19c1cc518a1653ef 100644 (file)
@@ -309,7 +309,9 @@ class QueryTest(fixtures.TablesTest):
         connection.execute(users.insert(), dict(user_id=8, user_name="fred"))
 
         u = bindparam("userid")
-        s = users.select(and_(users.c.user_name == u, users.c.user_name == u))
+        s = users.select().where(
+            and_(users.c.user_name == u, users.c.user_name == u)
+        )
         r = connection.execute(s, dict(userid="fred")).fetchall()
         assert len(r) == 1
 
@@ -581,20 +583,20 @@ class QueryTest(fixtures.TablesTest):
         connection.execute(users.insert(), dict(user_id=8, user_name="fred"))
         connection.execute(users.insert(), dict(user_id=9, user_name=None))
 
-        s = users.select(users.c.user_name.in_([]))
+        s = users.select().where(users.c.user_name.in_([]))
         r = connection.execute(s).fetchall()
         # No username is in empty set
         assert len(r) == 0
 
-        s = users.select(not_(users.c.user_name.in_([])))
+        s = users.select().where(not_(users.c.user_name.in_([])))
         r = connection.execute(s).fetchall()
         assert len(r) == 3
 
-        s = users.select(users.c.user_name.in_(["jack", "fred"]))
+        s = users.select().where(users.c.user_name.in_(["jack", "fred"]))
         r = connection.execute(s).fetchall()
         assert len(r) == 2
 
-        s = users.select(not_(users.c.user_name.in_(["jack", "fred"])))
+        s = users.select().where(not_(users.c.user_name.in_(["jack", "fred"])))
         r = connection.execute(s).fetchall()
         # Null values are not outside any set
         assert len(r) == 0
@@ -842,7 +844,7 @@ class QueryTest(fixtures.TablesTest):
 
         u = bindparam("search_key", type_=String)
 
-        s = users.select(not_(u.in_([])))
+        s = users.select().where(not_(u.in_([])))
         r = connection.execute(s, dict(search_key="john")).fetchall()
         assert len(r) == 3
         r = connection.execute(s, dict(search_key=None)).fetchall()
@@ -857,7 +859,7 @@ class QueryTest(fixtures.TablesTest):
         connection.execute(users.insert(), dict(user_id=8, user_name="fred"))
         connection.execute(users.insert(), dict(user_id=9, user_name=None))
 
-        s = users.select(not_(literal("john").in_([])))
+        s = users.select().where(not_(literal("john").in_([])))
         r = connection.execute(s).fetchall()
         assert len(r) == 3
 
@@ -879,13 +881,13 @@ class QueryTest(fixtures.TablesTest):
             ],
         )
 
-        s = users.select(users.c.user_name.in_([]) == True)  # noqa
+        s = users.select().where(users.c.user_name.in_([]) == True)  # noqa
         r = connection.execute(s).fetchall()
         assert len(r) == 0
-        s = users.select(users.c.user_name.in_([]) == False)  # noqa
+        s = users.select().where(users.c.user_name.in_([]) == False)  # noqa
         r = connection.execute(s).fetchall()
         assert len(r) == 3
-        s = users.select(users.c.user_name.in_([]) == None)  # noqa
+        s = users.select().where(users.c.user_name.in_([]) == None)  # noqa
         r = connection.execute(s).fetchall()
         assert len(r) == 0
 
index 892cfee535b88db3f7b950b55072fbf103c38774..b1ede060dfb99f2e6dd3cdc170624a0679e22a7f 100644 (file)
@@ -391,7 +391,9 @@ class CursorResultTest(fixtures.TablesTest):
             ],
         )
 
-        r = connection.execute(users.select(users.c.user_id == 2)).first()
+        r = connection.execute(
+            users.select().where(users.c.user_id == 2)
+        ).first()
         eq_(r.user_id, 2)
         eq_(r._mapping["user_id"], 2)
         eq_(r._mapping[users.c.user_id], 2)
@@ -411,7 +413,9 @@ class CursorResultTest(fixtures.TablesTest):
             ],
         )
 
-        r = connection.execute(users.select(users.c.user_id == 2)).first()
+        r = connection.execute(
+            users.select().where(users.c.user_id == 2)
+        ).first()
 
         eq_(r.user_id, 2)
         eq_(r._mapping["user_id"], 2)
@@ -766,7 +770,9 @@ class CursorResultTest(fixtures.TablesTest):
         users = self.tables.users
 
         connection.execute(users.insert(), dict(user_id=1, user_name="john"))
-        r = connection.execute(users.select(users.c.user_id == 1)).first()
+        r = connection.execute(
+            users.select().where(users.c.user_id == 1)
+        ).first()
         connection.execute(users.delete())
         connection.execute(users.insert(), r._mapping)
         eq_(connection.execute(users.select()).fetchall(), [(1, "john")])
@@ -1241,7 +1247,9 @@ class CursorResultTest(fixtures.TablesTest):
         users = self.tables.users
 
         connection.execute(users.insert(), dict(user_id=1, user_name="foo"))
-        r = connection.execute(users.select(users.c.user_id == 1)).first()
+        r = connection.execute(
+            users.select().where(users.c.user_id == 1)
+        ).first()
         eq_(r[0], 1)
         eq_(r[1], "foo")
         eq_([x.lower() for x in r._fields], ["user_id", "user_name"])
@@ -1288,7 +1296,7 @@ class CursorResultTest(fixtures.TablesTest):
             ),
         )
         r = connection.execute(
-            shadowed.select(shadowed.c.shadow_id == 1)
+            shadowed.select().where(shadowed.c.shadow_id == 1)
         ).first()
 
         eq_(r.shadow_id, 1)
index efa3be52374559710f0f9946fb99e3a8ca891a8f..00ef92efb8842ff4c3b239ba87b27f58e2ca84c9 100644 (file)
@@ -2422,9 +2422,9 @@ class ReduceTest(fixtures.TestBase, AssertsExecutionResults):
 
         item_join = polymorphic_union(
             {
-                "BaseItem": base_item_table.select(
-                    base_item_table.c.child_name == "BaseItem"
-                ).subquery(),
+                "BaseItem": base_item_table.select()
+                .where(base_item_table.c.child_name == "BaseItem")
+                .subquery(),
                 "Item": base_item_table.join(item_table),
             },
             None,