How to view exact storage capacity of Replit.db in python?

How do we view the exact amount of storage in the replit.db that has been used?
I am creating a user database which has a n number of keys. I need to find out how many profiles i can make with the free 50 MiB i get in replit db.

There is a limit of 5,000 keys on ReplitDB, so to find out how many free keys you have left, you can use this code: 5000 - len(db)

1 Like

Or, @level9neil , the Replit DB tool tab shows how many keys there are, and you can subtract that from 5000.
However, not all keys is 1kb. They vary depending on the size of each key.
Hope this helps!


how much storage would this take roughly?

db['accounts'][userid] = {
				'name':f"{str(self.first_name)} {str(self.last_name)}",
					    'from':"The Bot",
					    'title':"Welcome to the Mailing System!",
					    'body':f"This is the default message that is stored into your account.\n\nWe have support for newlines,\nTabs\t!\t!!!,\n**BOLD**, _Italics_, __Underlines__, ~~STRIKETHROUGHS~~, <Code blocks;>, and lastly, ||SECRETS🤫||",
					    'sent_at':str(dt.format('dddd DD MMMM YYYY')),
						'about':" "
					'format_long':str("UTC").format('dddd, Do MMMM, YYYY, hh:mm A (zz)'))

would the total keys in this be equivalent to the number of sub-keys in this, or is there something else to it?

I did this and it partially worked.
I saw the amount of keys update,
but I didn’t see the storage indicator go up, it was just stuck at 0/50 MiB. Even when i was at 120 keys in the database, it was stuck at 0.

Try closing and reopening the Database tab. If nothing changes, then your database is still too small for its storage to be displayed.

1 Like