Another Python SQLite Wrapper (APSW) support #34
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Another Python SQLite Wrapper (APSW) is an alternative to the built-in sqlite3 module. As well as more closely following SQLite's C API, APSW allows the use of newer SQLite versions than the system version. This can be a major boon on LTS Linux distributions.
The API is similar enough that I could quickly implement an adapter by tweaking the one for sqlite3.
The only real challenge was that cursor descriptions are only available during query execution, unlike in the sqlite3 module where they are available afterwards. I resolved this with the
_record_generator
function, but perhaps there is a better way.I added a test case for
select_one
with arecord_class
, because that branch did not seem to be covered. It's currently defined inusers_apsw.sql
, but perhaps it should be promoted all-adapter suite.There is one potential blocker: APSW is not easily installed using poetry. APSW is not available through PyPI. There is an apsw package on PyPI, but it should not be used. It is not controlled by the author of APSW and is several years out of date.
It is possible to install APSW using
pip
, and the relevant options can be specified in arequirements.txt
file, but this is not yet possible using poetry /pyproject.toml
. See python-poetry/poetry#845 for details.I was able to install APSW for testing by running the command from the APSW documentation, minus
--user
, throughpoetry run
:I'm interested to hear whether you find this to be an acceptable workaround.