Skip to content

Commit

Permalink
fix(mssql): use nvarchar to avoid non ascii be question mark
Browse files Browse the repository at this point in the history
  • Loading branch information
grieve54706 authored and cpcloud committed Nov 14, 2024
1 parent 56ec371 commit 564594f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion ibis/backends/mssql/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ def _get_schema_using_query(self, query: str) -> sch.Schema:
scale,
error_number,
error_message
FROM sys.dm_exec_describe_first_result_set({tsql}, NULL, 0)
FROM sys.dm_exec_describe_first_result_set(N{tsql}, NULL, 0)
ORDER BY column_ordinal
"""
with self._safe_raw_sql(query) as cur:
Expand Down
8 changes: 8 additions & 0 deletions ibis/backends/mssql/tests/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -311,3 +311,11 @@ def test_escape_special_characters():
assert test_func("1bis}Testing!") == "{1bis}}Testing!}"
assert test_func("{R;3G1/8Al2AniRye") == "{{R;3G1/8Al2AniRye}"
assert test_func("{R;3G1/8Al2AniRye}") == "{{R;3G1/8Al2AniRye}}}"


def test_non_ascii_column_name(con):
expr = con.sql("SELECT 1 AS [калона]")
schema = expr.schema()
names = schema.names
assert len(names) == 1
assert names[0] == "калона"

0 comments on commit 564594f

Please sign in to comment.