File tree 2 files changed +16
-1
lines changed
2 files changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -176,13 +176,17 @@ def do_connect(
176
176
self .con = pyodbc .connect (
177
177
user = user ,
178
178
server = f"{ host } ,{ port } " ,
179
- password = password ,
179
+ password = self . _escape_special_characters ( password ) ,
180
180
driver = driver ,
181
181
** kwargs ,
182
182
)
183
183
184
184
self ._post_connect ()
185
185
186
+ @staticmethod
187
+ def _escape_special_characters (value : str ) -> str :
188
+ return "{" + value .replace ("}" , "}}" ) + "}"
189
+
186
190
@util .experimental
187
191
@classmethod
188
192
def from_connection (cls , con : pyodbc .Connection ) -> Backend :
Original file line number Diff line number Diff line change @@ -300,3 +300,14 @@ def test_create_temp_table(con, temp):
300
300
assert t .columns == ("a" ,)
301
301
finally :
302
302
con .drop_table (name )
303
+
304
+
305
+ def test_escape_special_characters ():
306
+ test_func = ibis .backends .mssql .Backend ._escape_special_characters
307
+ assert test_func ("1bis_Testing!" ) == "{1bis_Testing!}"
308
+ assert test_func ("{1bis_Testing!" ) == "{{1bis_Testing!}"
309
+ assert test_func ("1bis_Testing!}" ) == "{1bis_Testing!}}}"
310
+ assert test_func ("{1bis_Testing!}" ) == "{{1bis_Testing!}}}"
311
+ assert test_func ("1bis}Testing!" ) == "{1bis}}Testing!}"
312
+ assert test_func ("{R;3G1/8Al2AniRye" ) == "{{R;3G1/8Al2AniRye}"
313
+ assert test_func ("{R;3G1/8Al2AniRye}" ) == "{{R;3G1/8Al2AniRye}}}"
You can’t perform that action at this time.
0 commit comments