diff options
author | Christian | 2020-05-28 17:31:09 -0500 |
---|---|---|
committer | Christian | 2020-05-28 17:31:09 -0500 |
commit | 65c0d507d1b2fb89826225fe572356647f335512 (patch) | |
tree | 8333f91b6ef8ebf686059038eb58750e6c381ae3 | |
parent | 55b654a9f40bb247272c45671c58c772874f43f6 (diff) | |
download | genenetwork2-65c0d507d1b2fb89826225fe572356647f335512.tar.gz |
Add redis functions for querying redis
-rw-r--r-- | wqflask/utility/redis_tools.py | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/wqflask/utility/redis_tools.py b/wqflask/utility/redis_tools.py index ca42f7b7..3db37223 100644 --- a/wqflask/utility/redis_tools.py +++ b/wqflask/utility/redis_tools.py @@ -28,6 +28,20 @@ def get_user_id(column_name, column_value): return None +def get_resource_id_by_data(res_type, res_data): + resource_list = Redis.hgetall("resources") + for key in resource_list: + resource_ob = json.loads(resource_list[key]) + + logger.info(resource_ob["data"]) + if resource_ob["type"] == res_type and resource_ob["data"] == res_data: + return key + + return None + +def get_resource(resource_id): + return json.loads(Redis.hget("resources", resource_id)) + def get_user_by_unique_column(column_name, column_value): item_details = None @@ -167,4 +181,4 @@ def change_group_name(user_id, group_id, new_name): group_info["name"] = new_name return group_info else: - return None
\ No newline at end of file + return None |