Ask coding questions

← Back to all posts
Database not saving
Xpym4uk (0)

(Aio)Sqlite3 database resetting when the programm restarting.
I need to do it not resetting, because i making bot for telegram with value system. On on each restart bot resetting database to first state file. Please help :(

OldWizard209 (1537)

Why don't u use replit's database?

Xpym4uk (0)

@OldWizard209 i need to use values by their owners, like "Select VALUE from OWNER". It needs to make for every user many single values

OldWizard209 (1537)

Yeah, you can still use the replit database. But you can save a list as a value to the key, and access the elements from there.

And the reason why your database is resetting is everytime the code runs, you are creating a new connection to the db. Create a connection only if a db has not already been created. @Xpym4uk

xfinnbar (82)

@Xpym4uk You can also use MongoDB atlas, which allows more advanced queries.

Xpym4uk (0)

@OldWizard209 no, not working. If i delete creating connection i cannot get/set/delete table values in database