Skip to content

Commit

Permalink
forward most connection settings to pytds
Browse files Browse the repository at this point in the history
  • Loading branch information
ecogels committed May 12, 2023
1 parent 88cefdc commit 15a1915
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

setup(
name="tds-django",
version="4.2.0",
version="4.2.1",
author="Etienne Cogels",
author_email="ecogels@users.noreply.github.com",
description="Django backend for SQL Server using tds",
Expand Down
6 changes: 5 additions & 1 deletion tds_django/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,14 +101,18 @@ class DatabaseWrapper(BaseDatabaseWrapper):
def get_connection_params(self):
settings_dict = self.settings_dict
# TODO warnings for user
# skipped: as_dict use_tz bytes_to_unicode row_strategy server(?)
allowed_params = 'timeout login_timeout appname tds_version use_mars auth readonly load_balancer ' \
'failover_partner cafile sock validate_host enc_login_only disable_connect_retry ' \
'pooling use_sso'.split()
conn_params = {
'dsn': settings_dict['HOST'] or 'localhost',
'port': settings_dict['PORT'] or 1433,
'database': settings_dict['NAME'],
'user': settings_dict['USER'],
'password': settings_dict['PASSWORD'],
'autocommit': getattr(settings, 'AUTOCOMMIT', False),
'use_mars': False,
**{k: v for k, v in settings_dict.items() if k in allowed_params},
}
return conn_params

Expand Down

0 comments on commit 15a1915

Please sign in to comment.