From cadfc608d63f4e0df46c0daaa28902423fd88d71 Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Mon, 23 Mar 2020 14:52:05 -0400 Subject: Convert schema_translate to a post compile Revised the :paramref:`.Connection.execution_options.schema_translate_map` feature such that the processing of the SQL statement to receive a specific schema name occurs within the execution phase of the statement, rather than at the compile phase. This is to support the statement being efficiently cached. Previously, the current schema being rendered into the statement for a particular run would be considered as part of the cache key itself, meaning that for a run against hundreds of schemas, there would be hundreds of cache keys, rendering the cache much less performant. The new behavior is that the rendering is done in a similar manner as the "post compile" rendering added in 1.4 as part of :ticket:`4645`, :ticket:`4808`. Fixes: #5004 Change-Id: Ia5c89eb27cc8dc2c5b8e76d6c07c46290a7901b6 --- test/dialect/postgresql/test_compiler.py | 3 +++ 1 file changed, 3 insertions(+) (limited to 'test/dialect/postgresql/test_compiler.py') diff --git a/test/dialect/postgresql/test_compiler.py b/test/dialect/postgresql/test_compiler.py index aabbc3ac3..316f0c240 100644 --- a/test/dialect/postgresql/test_compiler.py +++ b/test/dialect/postgresql/test_compiler.py @@ -229,12 +229,14 @@ class CompileTest(fixtures.TestBase, AssertsCompiledSQL): postgresql.CreateEnumType(e1), "CREATE TYPE foo.somename AS ENUM ('x', 'y', 'z')", schema_translate_map=schema_translate_map, + render_schema_translate=True, ) self.assert_compile( postgresql.CreateEnumType(e2), "CREATE TYPE bar.somename AS ENUM ('x', 'y', 'z')", schema_translate_map=schema_translate_map, + render_schema_translate=True, ) def test_create_table_with_schema_type_schema_translate(self): @@ -251,6 +253,7 @@ class CompileTest(fixtures.TestBase, AssertsCompiledSQL): CreateTable(table), "CREATE TABLE foo.some_table (q foo.somename, p bar.somename)", schema_translate_map=schema_translate_map, + render_schema_translate=True, ) def test_create_table_with_tablespace(self): -- cgit v1.2.1