I have a function in python which connects to sqlite DB which has 20k rows and just executes a simple select
query as below
def viewdata(mul):
conn = sqlite3.connect("mynew.db")
cursor = conn.cursor()
cursor.execute(("SELECT ad,abd,acd,ard FROM allrds WHERE mul<=?ORDER BY mul DESC LIMIT 1"),(mul,))
data = [i for i in cursor.fetchall()]
conn.close()
return data
its kind of slow, so i want to move this into in memory Database of SQLite, how can i copy this existing DB to in memory DB and make a connection
and fetch
the data and close
it once the operations are over. Is there anything different i need to do when connecting to memory databases? are the select
queries executed the same way like we do for on disk DB? Can someone please give me an example function