]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commit
quote driver name and pass-through keys in pyodbc connect string
authordxbjavid <dxbjavid@gmail.com>
Wed, 17 Jun 2026 12:49:06 +0000 (08:49 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Thu, 18 Jun 2026 20:47:34 +0000 (16:47 -0400)
commit8604972666978ca981623c7f415e405bc074663a
treea3c038ca85bf401c925651d1d069d85fd4108bff
parenta2e79928a933ef3a55a976d07d65c2e7d8c4284c
quote driver name and pass-through keys in pyodbc connect string

Tightened the construction of the ODBC connection string in the pyodbc
connector (as well as the mssql-python connector in 2.1) so that the
driver name, the names of pass-through connection parameters, and values
containing ``}`` are brace-quoted.  Previously a ``}`` in the driver name
or in a pass-through value, or a ``;`` in the name of a pass-through
parameter, could close the surrounding token early and allow the
remainder of the string to be interpreted as additional connection
attributes.  Pull request courtesy dxbjavid.

Fixes: #13380
Closes: #13379
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/13379
Pull-request-sha: 34433408bff86a9044be5d431b31688ab6d7578d

Change-Id: I5a0b522e62d306cf6dc59c7f61fe584df02a948d
doc/build/changelog/unreleased_20/13380.rst [new file with mode: 0644]
lib/sqlalchemy/connectors/pyodbc.py
lib/sqlalchemy/dialects/mssql/mssqlpython.py
test/dialect/mssql/test_engine.py