示例#1
0
class Filters(query.Query):
    id = query.Or(query.Equal(Device.id, fields.Integer()))
    type = query.Or(OfType(Device.type))
    model = query.ILike(Device.model)
    manufacturer = query.ILike(Device.manufacturer)
    serialNumber = query.ILike(Device.serial_number)
    # todo test query for rating (and possibly other filters)
    rating = query.Join((Device.id == events.EventWithOneDevice.device_id)
                        & (events.EventWithOneDevice.id == events.Rate.id),
                        RateQ)
    tag = query.Join(Device.id == Tag.device_id, TagQ)
    # todo This part of the query is really slow
    # And forces usage of distinct, as it returns many rows
    # due to having multiple paths to the same
    lot = query.Join(Device.id == LotDeviceDescendants.device_id, LotQ)
示例#2
0
class LotQ(query.Query):
    id = query.Or(
        query.Equal(LotDeviceDescendants.ancestor_lot_id, fields.UUID()))
示例#3
0
class TagQ(query.Query):
    id = query.Or(query.ILike(Tag.id), required=True)
    org = query.ILike(Tag.org)