apsw: Another Python SQLite Wrapper

tosh 75 points 17 comments October 11, 2026
github.com · View on Hacker News

Discussion Highlights (9 comments)

mont_tag

Thank you HackerNews. I learned something new and will be using APSW for my next Sqlite project.

scosman

It’s a great wrapper, but we should add a year. Not exactly new.

arc-in-space

This library is great, and recently saved a project of mine. Figuring out what was going on with some of python's sqlite3 quirks was too much of a hassle, meanwhile this more or less just worked the way I expected it to. Because of this experience I started defaulting to it over sqlite3 for other projects as well. (This documentation page explains the library's intent: https://rogerbinns.github.io/apsw/pysqlite.html )

Retr0id

In a sentence, I'd say apsw is "the SQLite lover's SQLite library". The python stdlib one tries to provide a generic interface ("DBAPI") which is great if you want to be able to swap to a different database engine later, but it's bad for actually getting the most out of SQLite.

dex0shubham

I was experimenting with APSW and I noticed that when a query doesn't return any row, it becomes difficult to get column names from the cursor, is there any recommended way to do this ?

jph00

For anyone interested in an ergonomic API over this-- I ported sqlite-utils to apsw a while back: https://github.com/AnswerDotAI/apswutils I've been using it a lot over the last year or two and it's worked great.

cleifer

If you are used to stdlib but want sane transactional semantics or the ability to easily statically link your own SQLite implementation (eg to have encryption), I’ve written some bindings as well: https://github.com/coleifer/cysqlite This supersedes my earlier pysqlite3 project. Perf is better than stdlib, but not as good as apsw. Roger is doing amazing work and I urge anyone wanting to fully utilize SQLite to try apsw. It does everything, exposes all API surfaces, and has a fantastic track record.

setheron

I remember working on https://github.com/fzakaria/sqlelf and I was curious about some performance; Immediately the maintainer responded with a very thorough set of benchmarks and improvements! The nicest part was that it turns out we lived in the same small-ish town and I didn't even know it.

TZubiri

This might not be a relevant place to comment, but it also might be. Has anyone ever gone through a phase (or is in a phase), of just writing and reading from files instead of cajoling everything into SQL databases and wrangling stringy queries? I find you can just make files with your own file formats and be fine, as long as your magic numbers make a cool mnemonic when read as hex. I'm sure I'll face a huge wall at some point in my development career, or I'll be forced to adopt SQL when inheriting a codebase, but I don't quite know what the main issue with this approach is with this. For the time being, whenever I read articles or Readmes like this it feels like my approach at least has the pro of not needing "yet another Python SQlite wrapper"

Semantic search powered by Rivestack pgvector
9,162 stories · 86,244 chunks indexed