Skip to content
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

Fix autocompletion for role names/user names #3766

Closed
wants to merge 1 commit into from

Conversation

frankgh
Copy link
Contributor

@frankgh frankgh commented Dec 31, 2024

patch by Francisco Guerrero; reviewed by TBD for CASSANDRA-20175

# 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")])
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

protect_name internally calls maybe_escape_name. Maybe I'm missing something, but what would be the benefit of using protect_name?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Basically, just use the "higher abstraction" provided in the driver? It is just a nit, but I am curious to why protect_name even exists.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to me it feels like it's more of a legacy method name : datastax/python-driver@0959b5d and not really a higher abstraction. But I don't have a lot of context on the history of these method names

@bbotella
Copy link
Contributor

bbotella commented Jan 2, 2025

+1 (nb)

patch by Francisco Guerrero; reviewed by TBD for CASSANDRA-20175
@smiklosovic smiklosovic closed this Feb 4, 2025
aweisberg pushed a commit to aweisberg/cassandra that referenced this pull request Mar 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants