Home > other >  Windows Authentication for polars connectorx SQL Server
Windows Authentication for polars connectorx SQL Server

Time:01-05

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?

CodePudding user response:

Yes, per SQL Server Windows Authentication Connectorx

Try dropping pyodbc for connectorx connection strings.

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

Also recommend for SQL Server Authentication

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