Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/358.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
从redis检索多个哈希,并使用python将键值与另一个dict或哈希进行比较_Python_Hash_Redis - Fatal编程技术网

从redis检索多个哈希,并使用python将键值与另一个dict或哈希进行比较

从redis检索多个哈希,并使用python将键值与另一个dict或哈希进行比较,python,hash,redis,Python,Hash,Redis,我的数据以多个散列形式存储在redis中。我需要将这些散列与相同键的字典相匹配,如果这些键的值相同,则需要检索所有这些散列。我是Redis的新手,无法找到解决方案 red_db.hset("trip1", "Customer_associated", "Garima") red_db.hset("trip1", "trip_date", "06/09/2019") red_db.hset("trip1", "trip_source", "Hyderabad") red_db.hset("trip

我的数据以多个散列形式存储在redis中。我需要将这些散列与相同键的字典相匹配,如果这些键的值相同,则需要检索所有这些散列。我是Redis的新手,无法找到解决方案

red_db.hset("trip1", "Customer_associated", "Garima")
red_db.hset("trip1", "trip_date", "06/09/2019")
red_db.hset("trip1", "trip_source", "Hyderabad")
red_db.hset("trip1", "trip_destination", "Banglore")
red_db.hset("trip2", "Customer_associated", "Sravya")
red_db.hset("trip2", "trip_date", "06/09/2019")
red_db.hset("trip2", "trip_source", "Hyderabad")
red_db.hset("trip2", "trip_destination", "Vijaywada")
red_db.hset("trip3", "Customer_associated", "Kartik")
red_db.hset("trip3", "trip_date", "06/09/2019")
red_db.hset("trip3", "trip_source", "Banglore")
red_db.hset("trip3", "trip_destination", "Vijaywada")
print(red_db.hgetall("trip1"))
现在,我有

req1 = {'User_Id': 1, 'trip_date':"06/09/2019",'trip_source':"Hyderabad", 'trip_destination':"Banglore"}

如何获取所有匹配的哈希值(trip1/trip2/trip3)

您检查过了吗?是的。但这不是必须的。