helpers.py 文件源码

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

项目:clickhouse-cli 作者: hatarist 项目源码 文件源码
def _allow_join_condition(statement):
    """
    Tests if a join condition should be suggested

    We need this to avoid bad suggestions when entering e.g.
        select * from tbl1 a join tbl2 b on a.id = <cursor>
    So check that the preceding token is a ON, AND, or OR keyword, instead of
    e.g. an equals sign.

    :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() in ('on', 'and', 'or')
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号