diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2016-01-08 22:11:09 -0500 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2016-01-08 22:12:25 -0500 |
| commit | 89facbed8855d1443dbe37919ff0645aea640ed0 (patch) | |
| tree | 33e7ab15470a5f3a76b748418e6be0c62aa1eaba /test/dialect/postgresql/test_compiler.py | |
| parent | 777e25694f1567ff61655d86a91be6264186c13e (diff) | |
| download | sqlalchemy-89facbed8855d1443dbe37919ff0645aea640ed0.tar.gz | |
- 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
Diffstat (limited to 'test/dialect/postgresql/test_compiler.py')
| -rw-r--r-- | test/dialect/postgresql/test_compiler.py | 18 |
1 files changed, 18 insertions, 0 deletions
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( |
