You are viewing a plain text version of this content. The canonical link for it is here.
Posted to pr@cassandra.apache.org by "bbotella (via GitHub)" <gi...@apache.org> on 2025/01/02 19:19:08 UTC
Re: [PR] Fix autocompletion for role names/user names [cassandra]
bbotella commented on code in PR #3766:
URL: https://github.com/apache/cassandra/pull/3766#discussion_r1901185345
##########
pylib/cqlshlib/cql3handling.py:
##########
@@ -1611,32 +1611,23 @@ def permission_completer(ctxt, _):
@completer_for('username', 'name')
def username_name_completer(ctxt, cass):
- def maybe_quote(name):
- if CqlRuleSet.is_valid_cql3_name(name):
- return name
- return "'%s'" % name
-
# disable completion for CREATE USER.
if ctxt.matched[0][1].upper() == 'CREATE':
return [Hint('<username>')]
session = cass.session
- return [maybe_quote(list(row.values())[0].replace("'", "''")) for row in session.execute("LIST USERS")]
+ return map(maybe_escape_name, [row['name'] for row in session.execute("LIST USERS")])
Review Comment:
What about using the wrapper `protect_name`?
https://github.com/datastax/python-driver/blob/master/cassandra/metadata.py#L1567
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org