I have a script that reads a list of users and reports from a MySQL database and runs a function for each of the values. The script checks the db every 5 minutes and adds these value pairs to a dictionary. As I loop through I don't want to re-add value pairs that are still in the dictionary. I've had no issues handling that with this code:
if (user, report) not in t1.reports_to_call:
t1.add(report, user)
My issue is that I want to also check a dictionary t2.reports_requested where the key is a tuple of three parts user, report and some_unknown_id. If there a way to run not in on a dictionary where you only know 2 of three elements and want to wildcard the third?
I have been also looking to see if I can refactor this secondary dictionary and move some_unknown_id out of the key as I do think it may be the case that the user/report pair is unique in this dictionary. But if I determine I need to wildcard the third value what is best way to do this?
{('user', 'report', 'some_unknown_id'): {}}