|
2 | 2 |
|
3 | 3 | <!-- do not remove -->
|
4 | 4 |
|
5 |
| -## 0.0.14 |
| 5 | +## 0.1.0 |
6 | 6 |
|
7 |
| -### New Features |
| 7 | +### Breaking Changes |
8 | 8 |
|
9 |
| -- sqlite3 => apsw ([#47](https://github.com/AnswerDotAI/fastlite/pull/47)), thanks to [@pydanny](https://github.com/pydanny) |
10 |
| - - https://github.com/AnswerDotAI/apswutils/pull/1 |
| 9 | +- fastlite has been rewritten to now use apsw instead of sqlite3 ([#47](https://github.com/AnswerDotAI/fastlite/pull/47)), thanks to [@pydanny](https://github.com/pydanny) |
| 10 | + - The key driver of this is that we found major concurrency and performance regressions in the python 3.12 sqlite3 module. However, there are many other good reasons also to switch to apsw. The python stdlib sqlite3 module is designed to focus on compatibility with the Python DB API, where apsw is designed to focus on compatibility with sqlite itself. We have found in production applications that with apsw's design it is far easier to get good performance and reliability compared to the stdlib module. |
11 | 11 |
|
12 |
| -- Use new `sqlite_minutils.Table.result` attribute ([#45](https://github.com/AnswerDotAI/fastlite/pull/45)), thanks to [@pydanny](https://github.com/pydanny) |
13 |
| - - > [!WARNING] |
14 |
| -> This pull request is dependent on https://github.com/AnswerDotAI/sqlite-minutils/pull/42. |
15 |
| -
|
16 |
| -Functions modified minimally to use the new `sqlite_minutils.Table.result` attribute: |
17 |
| - |
18 |
| -- [x] `Table.insert` |
19 |
| -- [x] `Table.update` |
20 |
| -- [x] `Table.upsert` |
21 |
| - |
22 |
| -## Tests verified to pass |
23 |
| - |
24 |
| -- [x] All fastlite tests and notebooks |
25 |
| -- [x] Fasthtml notebooks and adv_app |
26 |
| -- [x] Internal application tests |
| 12 | +### New Features |
27 | 13 |
|
| 14 | +- Use new `sqlite_minutils.Table.result` attribute ([#45](https://github.com/AnswerDotAI/fastlite/pull/45)), thanks to [@pydanny](https://github.com/pydanny) |
28 | 15 | - Make get_last defensive ([#39](https://github.com/AnswerDotAI/fastlite/pull/39)), thanks to [@pydanny](https://github.com/pydanny)
|
29 |
| - |
30 | 16 | - Rewrite insert() function to take advantage of RETURNING data ([#37](https://github.com/AnswerDotAI/fastlite/pull/37)), thanks to [@pydanny](https://github.com/pydanny)
|
31 |
| - - 1. Rewrites the `fastlite.insert()` method to take advantage of sqlite-minutil's incoming ability to return data on writes via the `RETURNING *` suffix to `INSERT`, `UPDATE`, and `INSERT` actions |
32 |
| -2. Converts kw.py to use nbdev. |
33 |
| -3. Dependency on https://github.com/AnswerDotAI/sqlite-minutils/pull/28, will fail unless running that code |
34 |
| - |
35 |
| -## Background |
36 |
| - |
37 |
| -Sqlite-minutils was designed as a CLI tool in to be written to by a single user often loading large sets of data periodically. Write actions are written for large imports, not individual actions, resulting in extra layers of abstraction for smaller actions which piggyback off the large imports. |
38 |
| - |
39 |
| -In comparison fastlite is designed for web environments with: |
40 |
| - |
41 |
| -1. Frequent writes of small bits of data |
42 |
| -4. Multiple users |
43 |
| - |
44 |
| -This PR therefore moves most of the logic for the patched version `insert` from sqlite-minutils to fastlite itself. While it does so, it also leverages utility functions from sqlite-minutils including `fix_square_braces` and `build_insert_queries_and_params`. |
45 |
| - |
46 |
| -This PR takes care to preserve the `.last_pk` prefix. |
47 |
| - |
48 |
| -## Dependency |
49 |
| - |
50 |
| -1. https://github.com/AnswerDotAI/sqlite-minutils/pull/28 |
51 | 17 |
|
52 | 18 | ### Bugs Squashed
|
53 | 19 |
|
54 | 20 | - Table.insert() with Falsy value generates an error ([#42](https://github.com/AnswerDotAI/fastlite/issues/42))
|
55 |
| - - While [writing tests for inserts](https://github.com/AnswerDotAI/fastlite/pull/41), we discovered `Table.insert()` when supplied with a Falsy value generates an error because the sqlite-minutils `insert` method expects a record. Not the empty dict provided when a Falsy value is provided as the record. See https://github.com/AnswerDotAI/fastlite/blob/23993b133c843ae5ada63e5a72bfd22bd822301d/fastlite/kw.py#L175 |
56 |
| - |
57 |
| -@audreyfeldroy and I think it should return an empty `dict` |
58 |
| - |
59 |
| -```python |
60 |
| -if not record: return {} |
61 |
| -``` |
62 |
| - |
63 |
| -Possibly even a None object: |
64 |
| - |
65 |
| -```python |
66 |
| -if not record: None |
67 |
| -``` |
68 |
| - |
69 |
| -Or maybe raise an error. |
70 |
| - |
71 |
| -```python |
72 |
| -if not record: raise InvalidRecordType |
73 |
| -``` |
74 | 21 |
|
75 | 22 |
|
76 | 23 | ## 0.0.13
|
|
0 commit comments