From 89facbed8855d1443dbe37919ff0645aea640ed0 Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Fri, 8 Jan 2016 22:11:09 -0500 Subject: - Multi-tenancy schema translation for :class:`.Table` objects is added. This supports the use case of an application that uses the same set of :class:`.Table` objects in many schemas, such as schema-per-user. A new execution option :paramref:`.Connection.execution_options.schema_translate_map` is added. fixes #2685 - latest tox doesn't like the {posargs} in the profile rerunner --- test/dialect/postgresql/test_compiler.py | 18 ++++++++++++++++++ 1 file changed, 18 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 71d8fa3e5..87e48d3f2 100644 --- a/test/dialect/postgresql/test_compiler.py +++ b/test/dialect/postgresql/test_compiler.py @@ -169,6 +169,24 @@ class CompileTest(fixtures.TestBase, AssertsCompiledSQL): "VARCHAR(1), CHECK (somecolumn IN ('x', " "'y', 'z')))") + def test_create_type_schema_translate(self): + e1 = Enum('x', 'y', 'z', name='somename') + e2 = Enum('x', 'y', 'z', name='somename', schema='someschema') + schema_translate_map = {None: "foo", "someschema": "bar"} + + self.assert_compile( + postgresql.CreateEnumType(e1), + "CREATE TYPE foo.somename AS ENUM ('x', 'y', 'z')", + schema_translate_map=schema_translate_map + ) + + self.assert_compile( + postgresql.CreateEnumType(e2), + "CREATE TYPE bar.somename AS ENUM ('x', 'y', 'z')", + schema_translate_map=schema_translate_map + ) + + def test_create_table_with_tablespace(self): m = MetaData() tbl = Table( -- cgit v1.2.1