def run(conn_mgr, input, **params):
    clubs = params.get("clubs", [])
    result = conn_mgr.run_graph(CLUBS_QUERY, {})
    result = materialize_records(result)
    nonempty = [c["id"] for c in result]
    result.extend([{"id": c, "score": 0} for c in clubs if c not in nonempty])
    return {"items": result}
def run(conn_mgr, input, **params):
    contexts = params["context"]
    if isinstance(contexts, str):
        contexts = [contexts]
    result = conn_mgr.run_graph(QUERY, {"contexts": contexts})
    result = materialize_records(result)
    return {"items": result}
示例#3
0
 def run_rdb(self, query, params):
     try:
         with self.sql_conn.cursor(cursor_factory=DictCursor) as cursor:
             cursor.execute(query, params)
             result = cursor.fetchall()
         return materialize_records(result)
     except psycopg2.Error as e:
         self.sql_conn.reset()
         raise e
示例#4
0
def run(conn_mgr, input, **params):
    query = build_query(params)
    query_result = conn_mgr.run_graph(
        query, {
            "ids": normalize_to_list(params.get("id")),
            "targets": normalize_to_list(params.get("target")),
            "authors": normalize_to_list(params.get("author"))
        })
    mapped_items = materialize_records(query_result)
    return {"items": sort_by_created_at(mapped_items)}
示例#5
0
def run(conn_mgr, input, **params):
    results = conn_mgr.run_graph(QUERY, params)
    return {"items": materialize_records(results)}
def run(conn_mgr, input, **ignore):
    results = conn_mgr.run_graph(QUERY, {})
    results = materialize_records(results)
    return {"items": results}
示例#7
0
def run(conn_mgr, input, **params):
    query_result = conn_mgr.run_graph(FIND_CLAIMS_WITH_ABOUT_ID, params)
    mapped_items = materialize_records(query_result)
    return {"items": sort_by_created_at(mapped_items)}
示例#8
0
def run(conn_mgr, input, **params):
    results = conn_mgr.run_graph(QUERY, {
        "token_id": params["id"],
        "asset": params["asset"]
    })
    return {"items": materialize_records(results)}
示例#9
0
def run(conn_mgr, input, **params):
    result = conn_mgr.run_graph(CLUBS_QUERY, {})
    result = materialize_records(result)
    return {"items": result}
示例#10
0
def run(conn_mgr, input, **params):
    query_result = conn_mgr.run_graph(LATEST_PURRERS, params)
    mapped_items = materialize_records(query_result)
    return {"items": sort_by_created_at(mapped_items)}
示例#11
0
def run(conn_mgr, input, **params):
    result = conn_mgr.run_graph(ALLOWANCE_QUERY, params)
    return {"items": materialize_records(result)}