Open danchr opened 7 years ago
Answering my own question, we settled on the following unholy hack:
import functools, sys
from sqlserver import base
from pytds import login
orig_gcp = base.DatabaseWrapper.get_connection_params_pytds
@functools.wraps(orig_gcp)
def get_connection_params_pytds(self):
"""Returns a dict of parameters suitable for get_new_connection."""
conn_params = orig_gcp(self)
conn_params['auth'] = login.SspiAuth(
user_name=conn_params['user'],
password=conn_params['password'],
server_name=conn_params['server'],
port=conn_params['port'],
)
return conn_params
base.DatabaseWrapper.get_connection_params_pytds = \
get_connection_params_pytds
We have to use Windows authentication in production, but I see you removed support for using the original ADO driver in 31b1ffba0118e1c1704494d02828f0b0ecc93f41. Perhaps because it was broken and tricky to actually use or test due to the dependancy on
python-tdb
?It so happens I fixed it locally and got
django-sqlserver
up and running on Django 1.11 (whichdjango-mssql
doesn't support) with the ADO driver, only to pull and discover that you removed it.So, my question is: Is it possible to use Windows authentication with the PyTDB driver, and if so, would you perhaps consider documenting it? If not, would you consider a patch to revive ADO support? After all,
django-mssql
doesn't seem all that active, and it'd be nice to use one driver everywhere.