]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
allowlist select(<table>.c) in legacy select() 5936/head
authorOliver Rice <github@oliverrice.com>
Sat, 13 Feb 2021 19:03:15 +0000 (13:03 -0600)
committerOliver Rice <github@oliverrice.com>
Sat, 13 Feb 2021 19:03:15 +0000 (13:03 -0600)
lib/sqlalchemy/sql/selectable.py
test/sql/test_deprecations.py

index ba3ccdec043c6eb8879d4fc1c6cdc6cc21db52d5..ad6b1cdcaf0c5648dcd298e8f9c5c73a369eb1ae 100644 (file)
@@ -39,6 +39,7 @@ from .base import Generative
 from .base import HasCompileState
 from .base import HasMemoized
 from .base import Immutable
+from .base import ImmutableColumnCollection
 from .base import prefix_anon_map
 from .coercions import _document_text_coercion
 from .elements import _anonymous_label
@@ -4871,9 +4872,7 @@ class Select(
 
         """
         if (
-            args
-            and hasattr(args[0], "__iter__")
-            and not hasattr(args[0], "strip")
+            args and isinstance(args[0], (list, ImmutableColumnCollection))
         ) or kw:
             return cls.create_legacy_select(*args, **kw)
         else:
index 3a6da1d13d324755694b75ce96dabe16a381fb59..81ea68496929ea72947a893ebb83af5d6807e326 100644 (file)
@@ -437,15 +437,6 @@ class SelectableTest(fixtures.TestBase, AssertsCompiledSQL):
             stmt = select([column("q")])
         self.assert_compile(stmt, "SELECT q")
 
-    def test_select_iterable_argument(self):
-
-        with testing.expect_deprecated_20(
-            r"The legacy calling style of select\(\) is deprecated "
-            "and will be removed in SQLAlchemy 2.0"
-        ):
-            stmt = select(iter([column("q")]))
-        self.assert_compile(stmt, "SELECT q")
-
     def test_select_immutable_column_collection_argument(self):
         t1 = table("t1", column("q"))