diff options
author | mike bayer <mike_mp@zzzcomputing.com> | 2020-06-01 19:43:04 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@bbpush.zzzcomputing.com> | 2020-06-01 19:43:04 +0000 |
commit | 1287853bf59a3e50b0a518d4410ff60305058131 (patch) | |
tree | eb525241420c5e919025550cdfdf7fb6d3f47181 /test/dialect/mssql/test_compiler.py | |
parent | a31a07ddad1812072511ee69b4e95be099330804 (diff) | |
parent | a7a19f292451e10aef489d87df27be7f58f831a8 (diff) | |
download | sqlalchemy-1287853bf59a3e50b0a518d4410ff60305058131.tar.gz |
Merge "Support multiple dotted sections in mssql schema names"
Diffstat (limited to 'test/dialect/mssql/test_compiler.py')
-rw-r--r-- | test/dialect/mssql/test_compiler.py | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/test/dialect/mssql/test_compiler.py b/test/dialect/mssql/test_compiler.py index 99308132b..5269225a4 100644 --- a/test/dialect/mssql/test_compiler.py +++ b/test/dialect/mssql/test_compiler.py @@ -21,6 +21,7 @@ from sqlalchemy import union from sqlalchemy import UniqueConstraint from sqlalchemy import update from sqlalchemy.dialects import mssql +from sqlalchemy.dialects.mssql import base as mssql_base from sqlalchemy.dialects.mssql import mxodbc from sqlalchemy.dialects.mssql.base import try_cast from sqlalchemy.sql import column @@ -524,6 +525,42 @@ class CompileTest(fixtures.TestBase, AssertsCompiledSQL): checkpositional=("bar",), ) + def test_schema_many_tokens_one(self): + metadata = MetaData() + tbl = Table( + "test", + metadata, + Column("id", Integer, primary_key=True), + schema="abc.def.efg.hij", + ) + + # for now, we don't really know what the above means, at least + # don't lose the dot + self.assert_compile( + select([tbl]), + "SELECT [abc.def.efg].hij.test.id FROM [abc.def.efg].hij.test", + ) + + dbname, owner = mssql_base._schema_elements("abc.def.efg.hij") + eq_(dbname, "abc.def.efg") + assert not isinstance(dbname, quoted_name) + eq_(owner, "hij") + + def test_schema_many_tokens_two(self): + metadata = MetaData() + tbl = Table( + "test", + metadata, + Column("id", Integer, primary_key=True), + schema="[abc].[def].[efg].[hij]", + ) + + self.assert_compile( + select([tbl]), + "SELECT [abc].[def].[efg].hij.test.id " + "FROM [abc].[def].[efg].hij.test", + ) + def test_force_schema_quoted_name_w_dot_case_insensitive(self): metadata = MetaData() tbl = Table( |