Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make PASSWORD optional if private_key_file is specified
Browse files Browse the repository at this point in the history
timgraham committed Dec 8, 2023

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
1 parent ca05756 commit 8eb66f8
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion django_snowflake/base.py
Original file line number Diff line number Diff line change
@@ -90,6 +90,7 @@ class DatabaseWrapper(BaseDatabaseWrapper):
introspection_class = DatabaseIntrospection
ops_class = DatabaseOperations

password_not_required_options = ('private_key', 'private_key_file', 'authenticator')
settings_is_missing = "settings.DATABASES is missing '%s' for 'django_snowflake'."

def get_connection_params(self):
@@ -111,7 +112,7 @@ def get_connection_params(self):

if settings_dict['PASSWORD']:
conn_params['password'] = settings_dict['PASSWORD']
elif 'private_key' not in conn_params and 'authenticator' not in conn_params:
elif all(x not in conn_params for x in self.password_not_required_options):
raise ImproperlyConfigured(self.settings_is_missing % 'PASSWORD')

if settings_dict.get('ACCOUNT'):

0 comments on commit 8eb66f8

Please sign in to comment.