Skip to content Skip to sidebar Skip to footer

Make Temporary Database With Sqlite

I wanna make a temporary database but I don't know I going in the right way or not I get the error no such table: list but I don't know why python raise that error this is my code:

Solution 1:

sqlite3.connect(":memory:") creates an in-memory database that only exists as long as the connection is in use.

The problem is that you're closing the database connection in each function. As soon as you close it, the in-memory database vanishes. INSERT fails because the table no longer exists.

You'll need to preserve (or pass) the conn and cur objects so that you can use them between functions.


Post a Comment for "Make Temporary Database With Sqlite"