summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/testing/provision.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2015-05-24 21:02:29 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2015-05-24 21:02:29 -0400
commit9157911013532e081f9ec6e29e7a4c271438f8ab (patch)
treeab51c801091028b74eaf4822ecca43ea84ae7eec /lib/sqlalchemy/testing/provision.py
parent0198d9aa5fee96c7523cc3e827baaba442c0ba02 (diff)
downloadsqlalchemy-9157911013532e081f9ec6e29e7a4c271438f8ab.tar.gz
- Added a new dialect flag to the MSSQL dialect
``legacy_schema_aliasing`` which when set to False will disable a very old and obsolete behavior, that of the compiler's attempt to turn all schema-qualified table names into alias names, to work around old and no longer locatable issues where SQL server could not parse a multi-part identifier name in all circumstances. The behavior prevented more sophisticated statements from working correctly, including those which use hints, as well as CRUD statements that embed correlated SELECT statements. Rather than continue to repair the feature to work with more complex statements, it's better to just disable it as it should no longer be needed for any modern SQL server version. The flag defaults to True for the 1.0.x series, leaving current behavior unchanged for this version series. In the 1.1 series, it will default to False. For the 1.0 series, when not set to either value explicitly, a warning is emitted when a schema-qualified table is first used in a statement, which suggests that the flag be set to False for all modern SQL Server versions. fixes #3424 fixes #3430
Diffstat (limited to 'lib/sqlalchemy/testing/provision.py')
-rw-r--r--lib/sqlalchemy/testing/provision.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/sqlalchemy/testing/provision.py b/lib/sqlalchemy/testing/provision.py
index c8f7fdf30..8469a0658 100644
--- a/lib/sqlalchemy/testing/provision.py
+++ b/lib/sqlalchemy/testing/provision.py
@@ -49,6 +49,7 @@ def configure_follower(follower_ident):
def setup_config(db_url, db_opts, options, file_config, follower_ident):
if follower_ident:
db_url = _follower_url_from_main(db_url, follower_ident)
+ _update_db_opts(db_url, db_opts)
eng = engines.testing_engine(db_url, db_opts)
eng.connect().close()
cfg = config.Config.register(eng, db_opts, options, file_config)
@@ -94,6 +95,11 @@ def _drop_db(cfg, eng, ident):
@register.init
+def _update_db_opts(db_url, db_opts):
+ pass
+
+
+@register.init
def _configure_follower(cfg, ident):
pass
@@ -105,6 +111,11 @@ def _follower_url_from_main(url, ident):
return url
+@_update_db_opts.for_db("mssql")
+def _mssql_update_db_opts(db_url, db_opts):
+ db_opts['legacy_schema_aliasing'] = False
+
+
@_follower_url_from_main.for_db("sqlite")
def _sqlite_follower_url_from_main(url, ident):
url = sa_url.make_url(url)