MCPcopy Create free account
hub / github.com/dbcli/mssql-cli / _allow_join

Function _allow_join

mssqlcli/packages/sqlcompletion.py:555–572  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

553
554
555def _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'))

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected