You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
With pyodbc I can use the following to connection Azure SQL Server:
def get_connection(connection_string, access_token):
exptoken = b""
for i in access_token:
exptoken += bytes({i})
exptoken += bytes(1)
tokenstruct = struct.pack("=i", len(exptoken)) + exptoken
SQL_COPT_SS_ACCESS_TOKEN = 1256
return pyodbc.connect(connection_string, attrs_before={SQL_COPT_SS_ACCESS_TOKEN: tokenstruct})
SQL_COPT_SS_ACCESS_TOKEN is specific to msodbcsql (documentation here) but unfortunately there's no obvious way for me to set this property with pypyodbc, since the ODBC API is hidden and attrs_before fails with:
File "...\pypyodbc.py", line 2427, in __init__
connectString = connectString + key + '=' + value + ';'
TypeError: can only concatenate str (not "dict") to str
Please can you expose the ODBC API?
The text was updated successfully, but these errors were encountered:
With pyodbc I can use the following to connection Azure SQL Server:
SQL_COPT_SS_ACCESS_TOKEN is specific to msodbcsql (documentation here) but unfortunately there's no obvious way for me to set this property with pypyodbc, since the ODBC API is hidden and attrs_before fails with:
Please can you expose the ODBC API?
The text was updated successfully, but these errors were encountered: