You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
be aware that support for mssql-python is included in SQLAlchemy 2.1, which is currently in beta. So, your command to install the additional dependencies should be
Error:
ConnectionStringParseError: Connection string parsing failed:
Incomplete specification: keyword '{' has no value (missing '=')
Unknown keyword 'authentication}' is not recognized
uri = "mssql+mssqlpython://hostname\Instancename:portnum/database?authentication=ActiveDirectoryIntegrated"
uri = "mssql+mssqlpython://hostname\Instancename/database?authentication=ActiveDirectoryIntegrated"
Ran with all these libs :
Name: SQLAlchemy
Version: 2.1.0b3
Hi ak (@akommera), arkdvd , I was unable to reproduce the issue on my end. The two connection strings shared earlier are being parsed correctly when using SQLAlchemy 2.1.0b3 together with the mssql-python driver, and I do not observe any parsing-related problems.
The specific two-line error message you're seeing is typically generated only when the connection string that ultimately reaches mssql_python.connect() contains an unbalanced {...} segment that spans across a ; delimiter and closes immediately before a = pair. For example:
Server=host\Inst;{ ;authentication}=ActiveDirectoryIntegrated;Database=db
^ ^
stray '{' closing '}' ends up on the 'authentication' side
The parser processes the connection string by splitting it into tokens separated by ;. In the example above, it encounters:
{ alone → "Incomplete specification: keyword '{' has no value (missing '=')"
authentication}=... → key parsed as literal authentication} → "Unknown keyword 'authentication}' is not recognized"
Next Steps
My current hypothesis is that the parsing error is not being caused by the URI itself. Instead, it appears that something in the environment may be modifying the connection string and injecting additional braces around a key=value segment before it reaches the driver.
Could you please run the following script in the environment where the issue occurs and share the output from the print() statement?
Script:
import sqlalchemy as sa
uri = r"mssql+mssqlpython://hostname\Instancename:portnum/database?authentication=ActiveDirectoryIntegrated"
For a correctly parsed connection string, we would expect output similar to:
(('Server=hostname\Instancename,1433;Database=database;Authentication=ActiveDirectoryIntegrated',), {})
This output will help us determine whether the connection string is being altered before it reaches the mssql-python driver and narrow down the source of the issue.
Hi ak (@akommera) , arkdvd
I’m closing this bug for now as we need some additional information to continue the investigation. Please feel free to reopen the bug once the requested data is available, and we’ll be happy to resume the analysis.
And still doesnt work, error message:
(mssql_python.exceptions.OperationalError) Driver Error: Client unable to establish connection; DDBC Error: [Microsoft]Named Pipes Provider: Could not open a connection to SQL Server [2].
(Background on this error at: https://sqlalche.me/e/21/e3q8)
Activity
github-actions commentedon Jul 31, 2026
Hi ak (@akommera), thank you for opening this issue!
Our team will review it shortly. We aim to triage all new issues within 24-48 hours and get back to you.
If you have additional information to share, please feel free to update the issue.
Thank you for your patience!
gordthompson commentedon Aug 2, 2026
If you are working from the polars documentation here
https://docs.pola.rs/user-guide/io/database/#sqlalchemy
be aware that support for mssql-python is included in SQLAlchemy 2.1, which is currently in beta. So, your command to install the additional dependencies should be
and your example code should look like this
arkdvd commentedon Aug 3, 2026
What should be connection string for win auth?
gordthompson commentedon Aug 3, 2026
According to
https://docs.sqlalchemy.org/en/21/dialects/mssql.html#connection-strings
that would be
arkdvd commentedon Aug 3, 2026
Error:
ConnectionStringParseError: Connection string parsing failed:
Incomplete specification: keyword '{' has no value (missing '=')
Unknown keyword 'authentication}' is not recognized
uri = "mssql+mssqlpython://hostname\Instancename:portnum/database?authentication=ActiveDirectoryIntegrated"
uri = "mssql+mssqlpython://hostname\Instancename/database?authentication=ActiveDirectoryIntegrated"
Ran with all these libs :
Name: SQLAlchemy
Version: 2.1.0b3
Name: pandas
Version: 3.0.1
Name: pyarrow
Version: 25.0.0
Name: mssql-python
Version: 1.12.0
subrata-ms commentedon Aug 5, 2026
Hi ak (@akommera), arkdvd , I was unable to reproduce the issue on my end. The two connection strings shared earlier are being parsed correctly when using SQLAlchemy 2.1.0b3 together with the mssql-python driver, and I do not observe any parsing-related problems.
The specific two-line error message you're seeing is typically generated only when the connection string that ultimately reaches mssql_python.connect() contains an unbalanced {...} segment that spans across a ; delimiter and closes immediately before a = pair. For example:
Server=host\Inst;{ ;authentication}=ActiveDirectoryIntegrated;Database=db
^ ^
stray '{' closing '}' ends up on the 'authentication' side
The parser processes the connection string by splitting it into tokens separated by ;. In the example above, it encounters:
Next Steps
My current hypothesis is that the parsing error is not being caused by the URI itself. Instead, it appears that something in the environment may be modifying the connection string and injecting additional braces around a key=value segment before it reaches the driver.
Could you please run the following script in the environment where the issue occurs and share the output from the print() statement?
Script:
import sqlalchemy as sa
uri = r"mssql+mssqlpython://hostname\Instancename:portnum/database?authentication=ActiveDirectoryIntegrated"
url = sa.engine.make_url(uri)
engine = sa.create_engine(uri)
print(engine.dialect.create_connect_args(url))
For a correctly parsed connection string, we would expect output similar to:
(('Server=hostname\Instancename,1433;Database=database;Authentication=ActiveDirectoryIntegrated',), {})
This output will help us determine whether the connection string is being altered before it reaches the mssql-python driver and narrow down the source of the issue.
gordthompson commentedon Aug 6, 2026
FWIW, I prefer to use
URL.create()wherever possible. It avoids string parsing, handles "funny" characters in attributes (e.g., passwords), etc..subrata-ms commentedon Aug 12, 2026
Hi ak (@akommera) , arkdvd
I’m closing this bug for now as we need some additional information to continue the investigation. Please feel free to reopen the bug once the requested data is available, and we’ll be happy to resume the analysis.
Thanks
Subrata
arkdvd commentedon Aug 12, 2026
This is what I see from parsing:
(('Server=HOSTNAME;Database=INSTANCENAME:PORTNUM/DATABASE;Authentication=ActiveDirectoryIntegrated',), {})
And still doesnt work, error message:
(mssql_python.exceptions.OperationalError) Driver Error: Client unable to establish connection; DDBC Error: [Microsoft]Named Pipes Provider: Could not open a connection to SQL Server [2].
(Background on this error at: https://sqlalche.me/e/21/e3q8)