11# Exqlite
22
3- An SQLite3 library with an Ecto adapter implementation.
3+ An Elixir SQLite3 library.
4+
5+ If you are looking for the Ecto adapater, take a look at the
6+ [ Ecto SQLite3 library] [ ecto_sqlite3 ] .
47
58
69## Caveats
@@ -9,9 +12,8 @@ An SQLite3 library with an Ecto adapter implementation.
912* Prepared statements are not immutable. You must be careful when manipulating
1013 statements and binding values to statements. Do not try to manipulate the
1114 statements concurrently. Keep it isolated to one process.
12- * Adding a ` CHECK ` constraint is not supported by the Ecto adapter. This is due
13- to how Ecto handles specifying constraints. In SQLite you must specify the
14- ` CHECK ` on creation.
15+ * Simultaneous writing is not supported by SQLite3 and will not be supported
16+ here.
1517* All native calls are run through the Dirty NIF scheduler.
1618* Datetimes are stored without offsets. This is due to how SQLite3 handles date
1719 and times. If you would like to store a timezone, you will need to create a
@@ -24,12 +26,12 @@ An SQLite3 library with an Ecto adapter implementation.
2426
2527``` elixir
2628defp deps do
27- {:exqlite , " ~> 0.4.9 " }
29+ {:exqlite , " ~> 0.5.0 " }
2830end
2931```
3032
3133
32- ## Usage Without Ecto
34+ ## Usage
3335
3436The ` Exqlite.Sqlite3 ` module usage is fairly straight forward.
3537
@@ -58,47 +60,6 @@ The `Exqlite.Sqlite3` module usage is fairly straight forward.
5860```
5961
6062
61- ## Usage With Ecto
62-
63- Define your repo similar to this.
64-
65- ``` elixir
66- defmodule MyApp .Repo do
67- use Ecto .Repo , otp_app: :my_app , adapter: Ecto .Adapters .Exqlite
68- end
69- ```
70-
71- Configure your repository similar to the following. If you want to know more
72- about the possible options to pass the repository, checkout the documentation
73- for ` Exqlite.Connection.connect/1 ` . It will have more information on what is
74- configurable.
75-
76- ``` elixir
77- config :my_app ,
78- ecto_repos: [MyApp .Repo ]
79-
80- config :my_app , MyApp .Repo ,
81- database: " path/to/my/database.db" ,
82- show_sensitive_data_on_connection_error: false ,
83- journal_mode: :wal ,
84- cache_size: - 64000 ,
85- temp_store: :memory ,
86- pool_size: 1
87- ```
88-
89-
90- ### Note
91-
92- * Pool size is set to ` 1 ` but can be increased to ` 4 ` . When set to ` 10 ` there
93- was a lot of database busy errors. Currently this is a known issue and is
94- being looked in to.
95-
96- * Cache size is a negative number because that is how SQLite3 defines the cache
97- size in kilobytes. If you make it positive, that is the number of pages in
98- memory to use. Both have their pros and cons. Check the documentation out for
99- [ SQLite3] [ 2 ] .
100-
101-
10263## Why SQLite3
10364
10465I needed an Ecto3 adapter to store time series data for a personal project. I
@@ -123,5 +84,4 @@ complicated and error prone.
12384
12485Feel free to check the project out and submit pull requests.
12586
126- [ 1 ] : < https://github.com/mmzeeman/esqlite >
127- [ 2 ] : < https://www.sqlite.org/pragma.html >
87+ [ ecto_sqlite3 ] : < https://github.com/kevinlang/ecto_sqlite3 >
0 commit comments