The TinyDB forum has found a new home at GitHub discussions. The content here remains as a read-only archive.
let say I have dict { k1 : v1, k2 : v2 }, how do I build query from this. I can not do directly .search( (Query().k1 == v1) & (Query().k2 == v2)), because the dict may also be :
{k2:v2} OR {k1:v1, k3:v3} OR ........
Hey vsraptor, sorry for taking so long to reply! Can you explain in what context you need to build a query from a dict? Shouldn't you be able to use an OR query? Basically something like (Query().k1 == v1) | (Query().k2 == v2)? Or do you have to exclude items where k1 and k2 exist but one of these values has the wrong value?
(Query().k1 == v1) | (Query().k2 == v2)
k1
k2
Markus