Added autocomplete for ADD and DROP identity statements

This commit is contained in:
rwelgosh 2024-12-26 18:41:38 -05:00
parent a88ff20469
commit b5ae7b7655
1 changed files with 13 additions and 0 deletions

View File

@ -268,6 +268,7 @@ JUNK ::= /([ \t\r\f\v]+|(--|[/][/])[^\n\r]*([\n\r]|$)|[/][*].*?[*][/])/ ;
| <schemaChangeStatement>
| <authenticationStatement>
| <authorizationStatement>
| <identityStatement>
;
<dataChangeStatement> ::= <insertStatement>
@ -316,6 +317,10 @@ JUNK ::= /([ \t\r\f\v]+|(--|[/][/])[^\n\r]*([\n\r]|$)|[/][*].*?[*][/])/ ;
| <listPermissionsStatement>
;
<identityStatement> ::= <addIdentityStatement>
| <dropIdentityStatement>
;
# timestamp is included here, since it's also a keyword
<simpleStorageType> ::= typename=( <identifier> | <stringLiteral> | "timestamp" ) ;
@ -1623,6 +1628,14 @@ def username_name_completer(ctxt, cass):
session = cass.session
return [maybe_quote(list(row.values())[0].replace("'", "''")) for row in session.execute("LIST USERS")]
syntax_rules += r'''
<addIdentityStatement> ::= "ADD" "IDENTITY" ( "IF" "NOT" "EXISTS" )? <stringLiteral>
"TO" "ROLE" <rolename>
;
<dropIdentityStatement> ::= "DROP" "IDENTITY" ( "IF" "NOT" "EXISTS" )? <stringLiteral>
;
'''
@completer_for('rolename', 'role')
def rolename_completer(ctxt, cass):