Let say I have a MySQL table XYZ and in that, I have two columns i.e. "filename" and "status", and I want to access only those files whose status is NotVisited.
SO, basically, when i am iterating a folder consist of files that I want to access, first I want to check if that file is present in the table and if not present I will add it into the table .
ID = "Visited"
files_ = glob.glob("test/**/*.dcm", recursive=True)
for i in files_:
    qur = cur.execute("SELECT filename FROM dicom2 WHERE filename == '{}' AND flag = '{}'".format(i, ID))
    cur.execute(qur)
    data = cur.fetchall()
    if data:
        print("EXIST")
    else:
        cur.execute("insert into dicom2(filename, flag) values('{}','{}')".format(i, ID))
        print("Added")
print("Done")
Basically, i am not able to get the logic or this below line
qur = cur.execute("SELECT filename FROM dicom2 WHERE filename == '{}' AND flag = '{}'".format(i, ID))
can anyone please help me with this?
Thanks.
