mkleehammer / pyodbc

Python ODBC bridge
https://github.com/mkleehammer/pyodbc/wiki
MIT No Attribution
2.88k stars 562 forks source link

set_attr can't be passed a string value. #1152

Closed jabbera closed 1 year ago

jabbera commented 1 year ago

Environment

All

Issue

set_attr can't be used to set strings. https://github.com/mkleehammer/pyodbc/blob/4829107c39fdd066b3d86ed6c226fb933b712eba/src/connection.cpp#L452-L458 This is becoming a problem for my use cases with the Apache Spark Samba ODBC driver which is used to access databricks sql sources.

Call the SQLSetConnectAttr function with SQL_ATTR_CREDENTIALS (122) as
the attribute and the new connection string as the value. The connector will
update the current connection string with the new access token.

This is the use case defined in the odbc specification: https://github.com/microsoft/ODBC-Specification/blob/master/ODBC%204.0.md#3251-sql_attr_credentials

gordthompson commented 1 year ago

similar: #505

jabbera commented 1 year ago

Dunno how I missed that.