Tests if a join should be suggested We need this to avoid bad suggestions when entering e.g. select * from tbl1 a join tbl2 b So check that the preceding token is a JOIN keyword :param statement: an sqlparse.sql.Statement :return: boolean
(statement)
| 527 | |
| 528 | |
| 529 | def _allow_join(statement): |
| 530 | """ |
| 531 | Tests if a join should be suggested |
| 532 | |
| 533 | We need this to avoid bad suggestions when entering e.g. |
| 534 | select * from tbl1 a join tbl2 b <cursor> |
| 535 | So check that the preceding token is a JOIN keyword |
| 536 | |
| 537 | :param statement: an sqlparse.sql.Statement |
| 538 | :return: boolean |
| 539 | """ |
| 540 | |
| 541 | if not statement or not statement.tokens: |
| 542 | return False |
| 543 | |
| 544 | last_tok = statement.token_prev(len(statement.tokens))[1] |
| 545 | return last_tok.value.lower().endswith("join") and \ |
| 546 | last_tok.value.lower() not in ("cross join", "natural join",) |
no outgoing calls
no test coverage detected