MCPcopy Create free account
hub / github.com/pgadmin-org/pgadmin4 / _allow_join

Function _allow_join

web/pgadmin/utils/sqlautocomplete/sqlcompletion.py:529–546  ·  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

527
528
529def _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",)

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected