Commit 5c53ab5c authored by Wei Shoulin's avatar Wei Shoulin
Browse files

add find refs

parent 8cfd792c
......@@ -31,7 +31,14 @@ class CatalogApi(object):
return Result.error(message = str(resp.error.detail))
datas.flush()
records = pickle.loads(datas.getvalue())
records, cols = records[0], records[1]
columns = []
for col in cols:
if col in columns:
columns.append("%s_1" % (col, ))
else:
columns.append(col)
return Result.ok_data(data = records).append("totalCount", totalCount).append("columns", kwargs['columns'])
return Result.ok_data(data = records).append("totalCount", totalCount).append("columns", columns)
except grpc.RpcError as e:
return Result.error(message="%s:%s" % (e.code().value, e.details()))
......@@ -114,8 +114,15 @@ def find_req(function, kwargs):
else:
records = pickle.loads(datas.getvalue())
records, cols = records[0], records[1]
columns = []
for col in cols:
if col in columns:
columns.append("%s_1" % (col, ))
else:
columns.append(col)
return Result.ok_data(data = records).append("totalCount", totalCount)\
.append("columns", cols)
.append("columns", columns)
except grpc.RpcError as e:
return Result.error(message="%s:%s" % (e.code().value, e.details()))
......
......@@ -17,6 +17,12 @@ class Level1DataApi(object):
return Result.error(message="brick_ids is not a list")
return find_req("Level1Servicer.FindByBrickIds", kwargs)
@grpc_channel
def find_refs_by_ids(self, **kwargs):
if not isinstance(get_parameter(kwargs, "ids"), list):
return Result.error(message="ids is not a list")
return find_req("Level1Servicer.FindRefsByIds", kwargs)
@grpc_channel
def find_by_ids(self, **kwargs):
if not isinstance(get_parameter(kwargs, "ids"), list):
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment