]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commit
Ensure SQL Server default schema name not interpreted as dot-separated tokens
authorMike Bayer <mike_mp@zzzcomputing.com>
Fri, 18 Oct 2019 01:29:51 +0000 (21:29 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Fri, 18 Oct 2019 02:13:58 +0000 (22:13 -0400)
commit8bb2b06436074bb8a4b9d76173df165e421f447f
tree40c18c0f24f58b197439b1bcec654506fe4cccfe
parented2b8531b5848503e904c0adb4c3df4d4f78dd03
Ensure SQL Server default schema name not interpreted as dot-separated tokens

Fixed an issue in the :meth:`.Engine.table_names` method where it would
feed the dialect's default schema name back into the dialect level table
function, which in the case of SQL Server would interpret it as a
dot-tokenized schema name as viewed by the mssql dialect, which would
cause the method to fail in the case where the database username actually
had a dot inside of it.  In 1.3, this method is still used by the
:meth:`.MetaData.reflect` function so is a prominent codepath. In 1.4,
which is the current master development branch, this issue doesn't exist,
both because :meth:`.MetaData.reflect` isn't using this method nor does the
method pass the default schema name explicitly.  The fix nonetheless
guards against the default server name value returned by the dialect from
being interpreted as dot-tokenized name under any circumstances by
wrapping it in quoted_name().

Fixes: #4923
Change-Id: I821bd38ed89b767eaca0bdffee7f8ba3baf82560
(cherry picked from commit f50c6a04067acf2cd2fc5e42d5acaa9206d9a078)
doc/build/changelog/unreleased_13/4923.rst [new file with mode: 0644]
lib/sqlalchemy/dialects/mssql/base.py
lib/sqlalchemy/engine/base.py
test/dialect/mssql/test_reflection.py