Update: Using file::memory: for the name of the memory database fixes the problem.
@ carltongibson: The migrations are run automatically whenever the server restarts, due to the changes to MemoryDbOnlyConfig
@ Devil: In our current project, we would like to use a relational cache, in order to store relational data from an external resource in a non-permanent manner.
@ andyide: Since we only use it for caching limited amounts of data, we donât expect to see any scalability issues.
When this is done, no disk file is opened. Instead, a new database is created purely in memory. The database ceases to exist as soon as the database connection is closed. Every :memory: database is distinct from every other. So, opening two database connections each with the filename â:memory:â will create two independent in-memory databases.
This gives me the impression that you would need to run migrate for every instance that opens a connection. Am I missing something here? (Also, Iâm finding it difficult to understand what the value of this would be in a Django environment.)
Youâre still going to run into problems when you have more than one process or your process restarts.
From the same docs:
Of course, all database connections sharing the in-memory database need to be in the same process. The database is automatically deleted and memory is reclaimed when the last connection to the database closes.
So each process instance of your project is going to be accessing a different database, and when the process is restarted, it all goes away.
Hi, I was wondering if someone else has had this issue, I havenât been able to fix it with file::memory: or file::memory:?cache=shared as the db name. Is there a proper fix for this? The issue being that when running the server, no database tables are found because the migrations have not been applied.
since we donât really need a database (other than for some frameworks, as mentioned), we thought the easiest way to solve this was to use the in memory db. We can also use a file db, but I still wanted to make sure if in-memory was still possible.