-
Notifications
You must be signed in to change notification settings - Fork 247
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Passing username for impersonation #334
base: master
Are you sure you want to change the base?
Conversation
Can you add a test for this feature? Maybe you can use the effective_user() builtin function to make sure that it had the intended effect. |
Do you mean kind of:
|
Something along those lines, yeah. I think the second part of that test is the most important. Mainly to prove that the 'effective_user' value gets plumbed all the way through to Impala correctly. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add a test for this potentially?
@@ -41,7 +41,7 @@ def connect(host='localhost', port=21050, database=None, timeout=None, | |||
use_ssl=False, ca_cert=None, auth_mechanism='NOSASL', user=None, | |||
password=None, kerberos_service_name='impala', use_ldap=None, | |||
ldap_user=None, ldap_password=None, use_kerberos=None, | |||
protocol=None): | |||
protocol=None,username=None): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: space after comma to be consistent with surrounding code and PEP8
log.debug('HiveServer2Connection(service=%s, default_db=%s)', service, | ||
default_db) | ||
self.service = service | ||
self.default_db = default_db | ||
self.impersonate=impersonate |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: spaces around = to be consistent with surrounding code and PEP8
@@ -122,6 +124,12 @@ def cursor(self, user=None, configuration=None, convert_types=True, | |||
|
|||
log.debug('.cursor(): getting new session_handle') | |||
|
|||
if self.impersonate != None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be "is not None" - see https://docs.quantifiedcode.com/python-anti-patterns/readability/comparison_to_none.html
#281 indicates that impersonation works on a per-cursor basis. Therefore can this PR be closed? I think it will be confusing to support impersonation in multiple places and this could lead to unintentional security issues where connections are re-used. |
Not needed |
No description provided.