]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
include TableClause.schema in cache key
authorMike Bayer <mike_mp@zzzcomputing.com>
Tue, 30 Aug 2022 14:47:24 +0000 (10:47 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Tue, 30 Aug 2022 14:47:24 +0000 (10:47 -0400)
Fixed issue where use of the :func:`_sql.table` construct, passing a string
for the :paramref:`_sql.table.schema` parameter, would fail to take the
"schema" string into account when producing a cache key, thus leading to
caching collisions if multiple, same-named :func:`_sql.table` constructs
with different schemas were used.

Fixes: #8441
Change-Id: Ic4b55b3e8ec53b4c88ba112691bdf60ea1d4c448

doc/build/changelog/unreleased_14/8441.rst [new file with mode: 0644]
lib/sqlalchemy/sql/selectable.py
test/sql/test_compare.py

diff --git a/doc/build/changelog/unreleased_14/8441.rst b/doc/build/changelog/unreleased_14/8441.rst
new file mode 100644 (file)
index 0000000..963850a
--- /dev/null
@@ -0,0 +1,10 @@
+.. change::
+    :tags: bug, sql
+    :tickets: 8441
+
+    Fixed issue where use of the :func:`_sql.table` construct, passing a string
+    for the :paramref:`_sql.table.schema` parameter, would fail to take the
+    "schema" string into account when producing a cache key, thus leading to
+    caching collisions if multiple, same-named :func:`_sql.table` constructs
+    with different schemas were used.
+
index a6047bec1770cb72345773e858a00a0a300d945d..ff21b4584eb37d22a215deedde23875855c4c13e 100644 (file)
@@ -2923,6 +2923,7 @@ class TableClause(roles.DMLTableRole, Immutable, NamedFromClause):
             InternalTraversal.dp_fromclause_canonical_column_collection,
         ),
         ("name", InternalTraversal.dp_string),
+        ("schema", InternalTraversal.dp_string),
     ]
 
     _is_table = True
index 8d6dc7553409db8d21ee3b8b696ec7968374dbfe..18f26887a18262afdb0c57c1e872954884cd424d 100644 (file)
@@ -268,6 +268,8 @@ class CoreFixtures:
         ),
         lambda: (
             table("a", column("x"), column("y")),
+            table("a", column("x"), column("y"), schema="q"),
+            table("a", column("x"), column("y"), schema="y"),
             table("a", column("x"), column("y"))._annotate({"orm": True}),
             table("b", column("x"), column("y"))._annotate({"orm": True}),
         ),