-
Notifications
You must be signed in to change notification settings - Fork 81
fix(mssql): escape special characters for odbc #889
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
ibis-server/app/model/data_source.py
Outdated
def _escape_special_characters_for_odbc(value: str) -> str: | ||
if ";" in value or value.startswith("{"): | ||
return "{" + value.replace("}", "}}") + "}" | ||
else: | ||
return value |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we always add brackets? Maybe we don't need to check if it contains any illegal character? 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems to be okay.
…til ibis handle special characters
The connection string test should wait until ibis handles special characters by ibis-project/ibis#10437. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @grieve54706 LGTM
filed #890 for it |
We found the error
Because the password of mssql includes special characters like
{R;3G1/8Al2AniRye
that start with{
or include;
.It should be covered by
{
and}
and replace}
with}}
.Reference:
https://github.com/mkleehammer/pyodbc/wiki/Connecting-to-databases
https://stackoverflow.com/questions/78531086/pyodbc-connection-string-correctly-escaping-password-with-special-characters/78532507#78532507