util.py 文件源码

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

项目:Flask_Blog 作者: sugarguo 项目源码 文件源码
def unwrap_order_by(clause):
    """Break up an 'order by' expression into individual column-expressions,
    without DESC/ASC/NULLS FIRST/NULLS LAST"""

    cols = util.column_set()
    stack = deque([clause])
    while stack:
        t = stack.popleft()
        if isinstance(t, ColumnElement) and \
            (
                not isinstance(t, UnaryExpression) or
                not operators.is_ordering_modifier(t.modifier)
        ):
            if isinstance(t, _label_reference):
                t = t.element
            if isinstance(t, (_textual_label_reference)):
                continue
            cols.add(t)
        else:
            for c in t.get_children():
                stack.append(c)
    return cols
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号