Polars connectorx SQL Server的Windows身份验证

eufgjt7s  于 2023-01-04  发布在  SQL Server
关注(0)|答案(1)|浏览(216)

Can we connect to SQL server using polars and connectorx? YES
The username I used in SQL Server Management Studio right after the below test without issue.

conn = 'mssql+pyodbc://username@server/database?driver=SQL+Server''&trusted_connection=yes'
cx.read_sql(conn,query)

[2023-01-01T19:12:44Z ERROR tiberius::tds::stream::token] Login failed for user 'user'. code=18456 [2023-01-01T19:12:44Z ERROR tiberius::tds::stream::token] Login failed for user 'user'. code=18456 [2023-01-01T19:12:45Z ERROR tiberius::tds::stream::token] Login failed for user 'user'. code=18456 [2023-01-01T19:12:47Z ERROR tiberius::tds::stream::token] Login failed for user 'user'. code=18456 [2023-01-01T19:12:51Z ERROR tiberius::tds::stream::token] Login failed for user 'user'. code=18456 [2023-01-01T19:12:57Z ERROR tiberius::tds::stream::token] Login failed for user 'user'. code=18456 [2023-01-01T19:13:10Z ERROR tiberius::tds::stream::token] Login failed for user 'user'. code=18456 Traceback (most recent call last): File "", line 1, in File "C:\Users\user\AppData\Local\Programs\Python\Python310\lib\site-packages\connectorx_init_.py", line 224, in read_sql result = _read_sql( RuntimeError: Timed out in bb8
Do I need to reconfigure my connection string?

2sbarzqh

2sbarzqh1#

是,根据SQL Server Windows Authentication Connectorx
尝试删除connectorx连接字符串的pyodbc。

conn = 'mssql://server/database?trusted_connection=true'
cx.read_sql(conn,query)

还建议用于SQL Server身份验证

conn ="mssql://Username:Password@Server/Database?driver=SQL+Server"

相关问题