-
Notifications
You must be signed in to change notification settings - Fork 175
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
Accept shorthand format for system roles #341
Conversation
trino/client.py
Outdated
def _format_roles(self, roles): | ||
def _format_roles(self, role, roles): | ||
if role and roles: | ||
raise ValueError("specify either 'role' or 'roles' parameter, but not both") |
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.
raise ValueError("specify either 'role' or 'roles' parameter, but not both") | |
raise ValueError("Specify either 'role' or 'roles' parameter, but not both") |
trino/client.py
Outdated
elif role is None and roles is None: | ||
return {} |
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.
I think this is no-op and can be removed.
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.
Why? Why not use the roles
mechanism instead?
Because catalog roles are rather a legacy concept. Only hive standard SQL leverages the catalog roles. All modern access systems use a single SYSTEM role. Most users are not aware about the catalog roles concept. Adding a single role will not confuse users but rather it will make the client more easy to use. |
e886aba
to
1319a18
Compare
README.md
Outdated
host='localhost', | ||
port=443, | ||
user='the-user', | ||
roles="roleC" # equivalent to {"system": "roleC"} |
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.
I would advise against a mixed case example unless we are full sure it works in all cases.
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.
good point.
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.
Changed to role1
1319a18
to
026e36f
Compare
Added role parameter