MCPcopy Create free account
hub / github.com/dbcli/mycli / _find_password_after_by

Function _find_password_after_by

mycli/packages/sql_utils.py:534–542  ·  view source on GitHub ↗

Find a password literal following a BY token (for ALTER USER ... IDENTIFIED BY 'pw').

(tokens: list[sqlglot.tokens.Token])

Source from the content-addressed store, hash-verified

532
533
534def _find_password_after_by(tokens: list[sqlglot.tokens.Token]) -> str | None:
535 """Find a password literal following a BY token (for ALTER USER ... IDENTIFIED BY 'pw')."""
536 tt = sqlglot.tokens.TokenType
537 for i, tok in enumerate(tokens):
538 if tok.token_type == tt.VAR and tok.text.upper() == 'BY' and i + 1 < len(tokens):
539 next_tok = tokens[i + 1]
540 if next_tok.token_type == tt.STRING:
541 return next_tok.text
542 return None
543
544
545def _find_password_after_eq(tokens: list[sqlglot.tokens.Token]) -> str | None:

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected