From aa50375a9aa72be896a7cf3afbbbec161c7111bd Mon Sep 17 00:00:00 2001 From: Shan Date: Sun, 22 Jan 2023 11:19:11 -0500 Subject: Run bracket interpretation for reflection Fixed bug where a schema name given with brackets, but no dots inside the name, for parameters such as :paramref:`_schema.Table.schema` would not be interpreted within the context of the SQL Server dialect's documented behavior of interpreting explicit brackets as token delimiters, first added in 1.2 for #2626, when referring to the schema name in reflection operations. The original assumption for #2626's behavior was that the special interpretation of brackets was only significant if dots were present, however in practice, the brackets are not included as part of the identifier name for all SQL rendering operations since these are not valid characters within regular or delimited identifiers. Pull request courtesy Shan. Fixes: #9133 Closes: #9134 Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/9134 Pull-request-sha: 5dac87c82cd3063dd8e50f0075c7c00330be6439 Change-Id: I7a507bc38d75a04ffcb7e920298775baae22c6d1 --- lib/sqlalchemy/dialects/mssql/base.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'lib/sqlalchemy') diff --git a/lib/sqlalchemy/dialects/mssql/base.py b/lib/sqlalchemy/dialects/mssql/base.py index b1f30d577..eabea88db 100644 --- a/lib/sqlalchemy/dialects/mssql/base.py +++ b/lib/sqlalchemy/dialects/mssql/base.py @@ -2871,10 +2871,8 @@ def _switch_db(dbname, connection, fn, *arg, **kw): def _owner_plus_db(dialect, schema): if not schema: return None, dialect.default_schema_name - elif "." in schema: - return _schema_elements(schema) else: - return None, schema + return _schema_elements(schema) _memoized_schema = util.LRUCache() -- cgit v1.2.1