]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
guard against schema_translate_map adding/removing None vs. caching
authorMike Bayer <mike_mp@zzzcomputing.com>
Tue, 10 Jun 2025 13:21:01 +0000 (09:21 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Tue, 10 Jun 2025 13:21:27 +0000 (09:21 -0400)
Change-Id: Iad29848b5fe15e314ad791b7fc0aac58700b0c68

test/dialect/postgresql/test_types.py

index 7f8dab584e7e1da075623b20b5bfbbe290b0bfec..6151ed2dcc00e8efd7b1595b2f25686f279784c3 100644 (file)
@@ -405,9 +405,18 @@ class NamedTypeTest(
             Column("value", dt),
             schema=symbol_name,
         )
-        conn = connection.execution_options(
-            schema_translate_map={symbol_name: testing.config.test_schema}
-        )
+
+        execution_opts = {
+            "schema_translate_map": {symbol_name: testing.config.test_schema}
+        }
+
+        if symbol_name is None:
+            # we are adding/ removing None from the schema_translate_map across
+            # runs, so we can't use caching else compiler will raise if it sees
+            # an inconsistency here
+            execution_opts["compiled_cache"] = None  # type: ignore
+
+        conn = connection.execution_options(**execution_opts)
         t1.create(conn)
         assert "schema_mytype" in [
             e["name"]