3

It is possible [in any way, even poorly hacked solution] to share in-memory database between many processes? My application has one process that opens the in-memory database and the other are running only SELECT queries on the database.

NOTE: I need solution only for python 2.7, and btw if it matters the module I use for making new processes is multiprocessing.

johndoe_asking
  • 141
  • 1
  • 3
  • 14
  • So you saying there is no way to do that in SQLite? it might be big headache to move to another db because I have already writtten whole program based on that. – johndoe_asking May 25 '16 at 11:08
  • If you've written the program in a sensible way, it should be easy to switch to another SQL-based DB that uses the Python DB API. – jonrsharpe May 25 '16 at 11:47
  • Why are you using `multiprocessing` and not threads? – CL. May 25 '16 at 18:59
  • Because I find out that multiprocessing fit more than threads in my application. – johndoe_asking May 25 '16 at 21:57
  • [Have you tried this on UNIX. Hope to help you out](http://stackoverflow.com/questions/18391381/how-to-pass-a-sqlite-connection-object-through-multiprocessing/37483250#37483250) – Tung Nguyen May 27 '16 at 12:14

1 Answers1

3

On Linux you can just use /dev/shm as the file location of your sqlite.

This is a memory mounted drive suitable exactly for that.

Shloim
  • 5,281
  • 21
  • 36