Example #1
0
def index():
    query = filter_query(Entity, Entity.all(), request.args)

    for schema in request.args.getlist('schema'):
        alias = aliased(Schema)
        query = query.join(alias, Entity.schemata)
        query = query.filter(alias.name.in_(schema.split(',')))

    pager = Pager(query)
    conv = lambda es: [entities.to_rest_index(e) for e in es]
    return jsonify(pager.to_dict(conv))
Example #2
0
def index():
    query = filter_query(Entity, Entity.all(), request.args)

    for schema in request.args.getlist('schema'):
        alias = aliased(Schema)
        query = query.join(alias, Entity.schemata)
        query = query.filter(alias.name.in_(schema.split(',')))

    pager = Pager(query)
    conv = lambda es: [entities.to_rest_index(e) for e in es]
    return jsonify(pager.to_dict(conv))
Example #3
0
def index():
    query = filter_query(Relation, Relation.all(), request.args)

    if request.args.get('source'):
        query = query.filter(Relation.source_id==request.args.getlist('source')[0])

    if request.args.get('target'):
        query = query.filter(Relation.target_id==request.args.getlist('target')[0])
    
    if request.args.get('schema'):
        schemata = request.args.get('schema').split(',')
        query = query.join(Schema)
        query = query.filter(Schema.name.in_(schemata))

    pager = Pager(query)
    validate_cache(keys=pager.cache_keys())
    return jsonify(pager, index=True)
Example #4
0
def index():
    query = filter_query(Relation, Relation.all(), request.args)

    if request.args.get('source'):
        query = query.filter(Relation.source_id==request.args.getlist('source')[0])

    if request.args.get('target'):
        query = query.filter(Relation.target_id==request.args.getlist('target')[0])
    
    if request.args.get('schema'):
        schemata = request.args.get('schema').split(',')
        query = query.join(Schema)
        query = query.filter(Schema.name.in_(schemata))

    pager = Pager(query)
    conv = lambda es: [relations.to_rest_index(e) for e in es]
    return jsonify(pager.to_dict(conv))
Example #5
0
def index():
    query = filter_query(Relation, Relation.all(), request.args)

    if request.args.get('source'):
        query = query.filter(
            Relation.source_id == request.args.getlist('source')[0])

    if request.args.get('target'):
        query = query.filter(
            Relation.target_id == request.args.getlist('target')[0])

    if request.args.get('schema'):
        schemata = request.args.get('schema').split(',')
        query = query.join(Schema)
        query = query.filter(Schema.name.in_(schemata))

    pager = Pager(query)
    conv = lambda es: [relations.to_rest_index(e) for e in es]
    return jsonify(pager.to_dict(conv))
Example #6
0
def index():
    query = filter_query(Entity, Entity.all(), request.args)

    if 'q' in request.args and len(request.args.get('q').strip()):
        q = '%%%s%%' % request.args.get('q').strip()
        query = query.join(EntityProperty)
        query = query.filter(EntityProperty.name=='name')
        query = query.filter(EntityProperty.value_string.ilike(q))

    for schema in request.args.getlist('schema'):
        if not len(schema.strip()):
            continue
        alias = aliased(Schema)
        query = query.join(alias, Entity.schemata)
        query = query.filter(alias.name.in_(schema.split(',')))

    query = query.filter(Entity.same_as==None)
    query = query.distinct()
    pager = Pager(query)
    validate_cache(keys=pager.cache_keys())
    return jsonify(pager, index=True)