Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Another Python SQLite Wrapper (APSW) support #34

Closed
wants to merge 2 commits into from

Conversation

iamthad
Copy link

@iamthad iamthad commented Aug 14, 2020

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 a record_class, because that branch did not seem to be covered. It's currently defined in users_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 a requirements.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, through poetry run:

poetry run pip install https://github.com/rogerbinns/apsw/releases/download/3.32.2-r1/apsw-3.32.2-r1.zip \
--global-option=fetch --global-option=--version --global-option=3.32.2 --global-option=--all \
--global-option=build --global-option=--enable-all-extensions

I'm interested to hear whether you find this to be an acceptable workaround.

@nackjicholson
Copy link
Owner

@iamthad Thanks for choosing to use your time contributing to this project! That's simply awesome.

I didn't know about this driver, I'll take a look and consider it. Even on it's own this pull request has been a good example of how to use the DriverAdapter protocol to extend aiosql.

I'm taking a vacation for the next two weeks. Please have patience, this might sit for a little while. before I review it. Thanks again!

@nackjicholson
Copy link
Owner

@iamthad Thanks again for this contribution. I'm not going to pull this into the project because I already have the normal sqlite3 driver. I will leave it open for people to discover and use as a reference for making driver adapters.

If you make this into a project of your own , say aiosql-apsw or whatever you would like to call it, let me know and I can link to it from the README and/or docs.

@nackjicholson nackjicholson reopened this Sep 27, 2020
@nackjicholson nackjicholson added the driver adapter New or prospective driver adapters label Sep 27, 2020
@nackjicholson nackjicholson force-pushed the master branch 3 times, most recently from 0d0742d to 24ac4eb Compare July 19, 2021 03:06
@zx80 zx80 mentioned this pull request Jul 4, 2022
@zx80
Copy link
Collaborator

zx80 commented Jul 5, 2022

See #108

@zx80 zx80 closed this Jul 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
driver adapter New or prospective driver adapters
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants