elixir-sqlite / exqlite

An SQLite3 driver for Elixir
https://hexdocs.pm/exqlite
MIT License
217 stars 48 forks source link

Allow the use of a file: uri for a database #225

Closed mikestok closed 1 year ago

mikestok commented 1 year ago

This change allows SQLite3 to load data from files on a read only file system using Ecto and ecto_sqlite3 which use exqlite.

Looking at https://sqlite.org/uri.html I saw that I could use a file url to pass in the mode=ro and immutable=1 parameters to sqlite3 to prevent the creation of -wal and -shm files. I noticed that there were still some empty directories with names starting with file: appearing on my laptop.

This is the least intrusive change I could make to the code to allow for file: uris to work.

I chose to use URI.parse/1 rather than URI.new!/1 or URI.new/1 as the last two functions need Elixir 1.13.

warmwaffles commented 1 year ago

I don't see a reason to not allow this. Since it is core to sqlite.

warmwaffles commented 1 year ago

Released under v0.12.0