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)
| 553 | |
| 554 | |
| 555 | def _allow_join(statement): |
| 556 | """ |
| 557 | Tests if a join should be suggested |
| 558 | |
| 559 | We need this to avoid bad suggestions when entering e.g. |
| 560 | select * from tbl1 a join tbl2 b <cursor> |
| 561 | So check that the preceding token is a JOIN keyword |
| 562 | |
| 563 | :param statement: an sqlparse.sql.Statement |
| 564 | :return: boolean |
| 565 | """ |
| 566 | |
| 567 | if not statement or not statement.tokens: |
| 568 | return False |
| 569 | |
| 570 | last_tok = statement.token_prev(len(statement.tokens))[1] |
| 571 | return (last_tok.value.lower().endswith('join') and |
| 572 | last_tok.value.lower() not in('cross join', 'natural join')) |
no outgoing calls
no test coverage detected