Skip to content

Conversation

@mikestok
Copy link
Contributor

@mikestok mikestok commented Dec 6, 2022

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
Copy link
Member

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

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.
Comment on lines +79 to +80
# In most of the test matrix the message is "attempt to write a readonly database",
# but in Elixir 1.13, OTP 23, OS windows-2019 it is "not an error".
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's bizarre.

@warmwaffles warmwaffles merged commit 57019dd into elixir-sqlite:main Dec 7, 2022
@warmwaffles
Copy link
Member

Released under v0.12.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants