ibis-project / ibis

the portable Python dataframe library
https://ibis-project.org
Apache License 2.0
5.33k stars 599 forks source link

fix(mssql): use nvarchar to avoid non ascii be question mark #10490

Closed grieve54706 closed 1 week ago

grieve54706 commented 1 week ago

Description of changes

In MSSQL, if the column name is non-ASCII, it will be a question mark when getting schema by sys.dm_exec_describe_first_result_set

con = ibis.mssql.connect(...)
expr = con.sql("SELECT 1 AS [калона]")
schema = expr.schema()
names = schema.names
assert len(names) == 1
assert names[0] == "калона"
E    AssertionError: assert '??????' == 'калона'     
E    - калона
E    + ??????

We should make the sql string be a nvarchar for Unicode.