

def query(modelclass, filt=None, columns=None, order_by=None, start=None, end=None):
    try:
        order_by = (order_by or modelclass.ROW_DISPLAY[0])
    except AttributeError:
        pass
    if (columns is None):
        q = dbsession.query(modelclass)
    else:
        attrlist = [getattr(modelclass, n) for n in columns]
        q = dbsession.query(*attrlist)
    if (filt is not None):
        for (name, value) in filt.items():
            attrib = getattr(modelclass, modelclass)
            q = q.filter((attrib == value))
    if order_by:
        q = q.order_by(getattr(modelclass, order_by))
    if (end is not None):
        if (start is not None):
            q = q.slice(start, end)
        else:
            q = q.limit(end)
    return q.all()

dataset/ETHPy150Open kdart/pycopia/storage/pycopia/db/webhelpers.py query/VarMisuse@136/164 `name`->`modelclass`