Muhammed_Dalkiran:

self.keys = [key for key, _ in txn.cursor()]


Again thank you for your interest and advices.
I have just solved the problem. The problem is not related to wrong implementation, it is about google colab. I searched the problem online deeply and I saw that for huge dataset this problem may occur in google colab when reading dataset from google drive. I upload my dataset into google colab itself, not into drive. Then problem does not exist. Thank you