From bb946be12cb24fd02dd61d0bc72991ab8b92aec7 Mon Sep 17 00:00:00 2001 From: vindarel Date: Tue, 12 Nov 2024 19:16:05 +0100 Subject: [PATCH] databases: in-memory SQLite --- databases.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/databases.md b/databases.md index c07f297..aa599e2 100644 --- a/databases.md +++ b/databases.md @@ -106,6 +106,22 @@ You might make good use of a wrapper function: (mito:connect-toplevel :sqlite3 :database-name "myapp")) ~~~ +### Connecting to an in-memory DB (SQLite) + +To connect to a `sqlite3` in-memory database, you use the ":memory:" +string as the DB name. It has a special meaning for SQLite. + +~~~lisp +(mito:connect-toplevel :sqlite3 :database-name ":memory:") +~~~ + +This doesn't create a file on disk, and the DB will be even +faster. But you'll loose all the data when you close the +connection. It is consequently specially useful for unit-tests, to +load data for temporary analytics, etc. + +You can read more about [in-memory SQLite databases here](https://www.sqlite.org/inmemorydb.html). + ### Models #### Defining models