(token: str | Token | None)
| 89 | |
| 90 | |
| 91 | def _normalize_token_value(token: str | Token | None) -> str | None: |
| 92 | if isinstance(token, str): |
| 93 | return token.lower() |
| 94 | if isinstance(token, Comparison): |
| 95 | # If 'token' is a Comparison type such as |
| 96 | # 'select * FROM abc a JOIN def d ON a.id = d.'. Then calling |
| 97 | # token.value on the comparison type will only return the lhs of the |
| 98 | # comparison. In this case a.id. So we need to do token.tokens to get |
| 99 | # both sides of the comparison and pick the last token out of that |
| 100 | # list. |
| 101 | return token.tokens[-1].value.lower() |
| 102 | if token is None: |
| 103 | return None |
| 104 | return token.value.lower() |
| 105 | |
| 106 | |
| 107 | def _build_suggest_context( |
no outgoing calls