summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/dialects/mssql/base.py
diff options
context:
space:
mode:
authorShan <shan224@gmail.com>2023-01-22 11:19:11 -0500
committerMike Bayer <mike_mp@zzzcomputing.com>2023-01-23 10:48:41 -0500
commitaa50375a9aa72be896a7cf3afbbbec161c7111bd (patch)
treec7f9efa34a14a8796c47fd9ab59fd092f7202862 /lib/sqlalchemy/dialects/mssql/base.py
parent2f91dd79310657814ad28b6ef64f91fff7a007c9 (diff)
downloadsqlalchemy-aa50375a9aa72be896a7cf3afbbbec161c7111bd.tar.gz
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
Diffstat (limited to 'lib/sqlalchemy/dialects/mssql/base.py')
-rw-r--r--lib/sqlalchemy/dialects/mssql/base.py4
1 files changed, 1 insertions, 3 deletions
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()