helpers.py 文件源码

python
阅读 21 收藏 0 点赞 0 评论 0

项目:clickhouse-cli 作者: hatarist 项目源码 文件源码
def _allow_join(statement):
    """
    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 <cursor>
    So check that the preceding token is a JOIN keyword

    :param statement: an sqlparse.sql.Statement
    :return: boolean
    """

    if not statement or not statement.tokens:
        return False

    last_tok = statement.token_prev(len(statement.tokens))[1]
    return (
        last_tok.value.lower().endswith('join') and last_tok.value.lower() not in(
            'cross join', 'natural join'))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号