Charles Leifer
charlesleifer.com · Personal blog · on HN since 2009
Charles Leifer is a Python developer who writes about SQLite, embedded databases, and Python language trends.
What HN saysCommenters cite his guide to compiling SQLite for Python and his monospace font list, and some agree with his criticism of Python's direction.
74HN people shared it
20linked it in comments
128stories submitted
1.4Kstory points
5 months agolast shared
2009people per year2026
Most-shared posts
- 1Your idea sucks5 people · 18 points · first shared 2017 · 1 comments on HN
- 2New features planned for Python 4.05 people · 17 points · first shared 2019 · 5 comments on HN
- 3Going Fast with SQLite and Python5 people · 8 points · first shared 2017 · discussion on HN
- 4What happened to Python?4 people · 64 points · first shared 2017 · 92 comments on HN
- 5AsyncIO4 people · 8 points · first shared 2023 · 1 comments on HN
- 6Completely un-scientific benchmarks of 13 embedded databases with Python4 people · 2 points · first shared 2014 · discussion on HN
- 7SQLite: Small, Fast, Reliable – Choose any three3 people · 208 points · first shared 2014 · 83 comments on HN
- 8Five reasons you should use SQLite in 20163 people · 15 points · first shared 2016 · discussion on HN
- 9Describing projects as “For Humans” must stop3 people · 8 points · first shared 2016 · discussion on HN
- 10Compiling sqlite for use with python applications3 people · first shared 2018
- 11Using python and k-means to find dominant colors in images2 people · 189 points · first shared 2012 · 31 comments on HN
- 12Multi-threaded SQLite without the OperationalErrors (2017)2 people · 77 points · first shared 2017 · 19 comments on HN
- 13Peewee, a lightweight python ORM2 people · 75 points · first shared 2010 · 16 comments on HN
- 14Encrypted SQLite Databases with Python and SQLCipher2 people · 9 points · first shared 2014 · discussion on HN
- 15How to use Sqlite's JSON extension in your Python app2 people · 9 points · first shared 2016 · discussion on HN
What HN people wrote when they linked it
cleifer · 2026-05-09
Loved Brooks’ and feel like I must’ve internalized his model because that’s all I care about anymore in dev. Coherence among the components (people or software) to produce something good. I think of if 100 pianos are tuned to the same tuning fork then they all play well together.
AI accelerated iteration and undisciplined use seem to me the main risk lately. Drift from any prompting, accumulation of features, plausible looking patches that are actually slop. Wrote about this recently [0], it creates a dynamic where you aren’t just making the software less coherent, you’re paying more and more to make it so. Curious to hear others experience of this.
[0] https://charlesleifer.com/blog/tokens-and-dreams/
coleifer · 2019-10-20
I compiled a large list of monospace coding fonts a couple years ago. Includes screenshots and links:
http://charlesleifer.com/blog/monospace-font-favorites/
Hope someone else finds it useful.
reipahb · 2016-02-18
The difference is that the last one also matches requests to "/", while the regex ensures that there is at least a single character after the "/".
That allows "/" to be used for other purposes, e.g. redirecting to the main page of the site, or displaying a nice error page. (However, in this case it simply shows the default Debian Nginx installation page: http://m.charlesleifer.com/ )
simonw · 2018-08-15
Charles provided really great documentation on how to build this here: http://charlesleifer.com/blog/compiling-sqlite-for-use-with-python-app…
Or if you're feeling lazy (like I was), there's a fork of his library at https://github.com/karlb/pysqlite3 which compiles the 3.25.0 amalgamation by default. This worked for me:
$ python3 -mvirtualenv venv
$ source venv/bin/activate
$ pip install git+git://github.com/karlb/pysqlite3
Collecting git+git://github.com/karlb/pysqlite3
...
Installing collected packages: pysqlite3
Successfully installed pysqlite3-0.2.0
$ python
Python 3.6.5 (default, Mar 30 2018, 06:41:53)
[GCC 4.2.1 Compatible Apple LLVM 9.0.0 (clang-900.0.39.2)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import pysqlite3
>>> pysqlite3.connect(":memory:").execute("select sqlite_version()").fetchall()
[('3.25.0',)]
swingingFlyFish · 2024-04-14
I've been using Python since 2.x and I have to admit which each new release I toy with leaving this language behind. Type hints are the latest warts in what should have been a beautiful language. I tend to agree with Charles Lesleifer and others here. Python3 is a mess. https://charlesleifer.com/blog/what-happened/
mikepurvis · 2024-02-02
My limitation with it is that it means I have to recompile sqlite for my use case. That's sometimes easy and obvious to do, but it's a lot more of a pain if it's, say, the sqlite embedded in my language interpreter and I just signed myself up for compiling a custom Python to support my project.
That said, I just googled it and it turns out I'm being a bit dramatic— it's actually not super hard to dynamically link Python to a custom-built sqlite: https://charlesleifer.com/blog/compiling-sqlite-for-use-with-python-ap…
speedgoose · 2024-02-01
If you are into alternative storage engines for SQLite, there is also an LSM (Log-Structured Merge-tree) extension in the main repository that is not announced nor documented but seems to work. It’s based on the SQLite 4 project.
https://github.com/sqlite/sqlite/tree/master/ext/lsm1
https://www.charlesleifer.com/blog/lsm-key-value-storage-in-sqlite3/
hdjjhhvvhga · 2022-05-04
> GDBM, Kyoto Cabinet, etc -- Useful if you are programming in late 1990s
Hold your horses:
https://charlesleifer.com/blog/completely-un-scientific-benchmarks-of-…
While I would never consider GDBM for any new project, I wouldn't dismiss its performance for small/locally accessed data stores.
rekwah · 2020-12-26
Tangentially related to graph dbs, but if you're looking for more hierarchical support, SQLite does has a transitive closure extension[0] that might be of some assistance. I leveraged this back in 2014 to write our framework-agnostic result storage on AWS Device Farm.
[0] - https://www.sqlite.org/cgi/src/artifact/636024302cde41b2bf0c542f81c40c…
[1] - https://charlesleifer.com/blog/querying-tree-structures-in-sqlite-usin…
oefrha · 2020-01-20
> Some SQLite wrappers (notably, Python's) mess with the start and rollbacks of transactions and make this appear buggy.
@coleifer (author of peewee) has a pretty informative blog post exploring — in part — transactional semantics, which might be of value to people who want to know more about this.
https://charlesleifer.com/blog/going-fast-with-sqlite-and-python/
patelajay285 · 2019-08-23
Hi @coleifer, I'll disagree, I'm the author. I don't think they are gross hacks, just a more sensible default configuration. In fact, I used a lot of your advice from your blog post https://charlesleifer.com/blog/going-fast-with-sqlite-and-python/ while making this library.
Fair enough if you want to compile your own version, but there's a lot of people and Python devs who don't know how / won't go through the effort and that's what this project is for.
It's also a work in progress and not meant to be released yet. Shoot me an e-mail [email protected] if you have suggestions for how to improve it.
Erwin · 2016-12-14
This might benefit from SQLite's Virtual tables: https://sqlite.org/vtab.html
With Virtual Tables you can expose any data source as a SQLite table -- then you can use every SQL feature that sqlite offers. You can just tell sqlite how to iterate through your data with a few functions, with an option to push down filtering information for efficiency.
You can also create your own aggregates, functions etc.
Here's an article where the author exposes redis as a table within sqlite: http://charlesleifer.com/blog/extending-sqlite-with-python/
rlander · 2015-12-25
Sqlite can and is widely used in production server-side.
It's about time the "develoment only" myth was laid to rest. Please read the links bellow:
https://charlesleifer.com/blog/sqlite-small-fast-reliable-choose-any-t…
http://stackoverflow.com/questions/1711631/improve-insert-per-second-p…
http://stackoverflow.com/questions/784173/what-are-the-performance-cha…
smt88 · 2015-10-18
It sounds like you're describing an embeddable document store. There are options for that as well:
- UnQLite: http://charlesleifer.com/blog/python-bindings-for-unqlite-an-embedded-…
- tinydb: https://pypi.python.org/pypi/tinydb/
- Blitz: https://github.com/adewes/blitzdb
networked · 2015-08-28
Vedis is called an ACID database on its website and rlite is called "transactional" in the read-me, so I assume that, like SQLite, by default they sync at the end of each transaction. Even if this weren't the case, though, I think the comparison would still be appropriate. Any embedded database, regardless of its stated use case, is in direct competition with SQLite because the latter dominates the market (and for good reason!).
Looking for existing benchmarks of this kind I have found one that compares Vedis, Redis and SQLite: http://charlesleifer.com/blog/completely-un-scientific-benchmarks-of-s…
StavrosK · 2015-08-27
I don't think comparing against SQLite would be meaningful, SQLite is full ACID with synchronous writes.
This post looks interesting:
http://charlesleifer.com/blog/alternative-redis-like-databases-with-py…
retrodict · 2015-04-16
https://charlesleifer.com/blog/completely-un-scientific-benchmarks-of-… does some basic performance comparisons for unqlite, vedis, dbm and kyotocabinet, leveldb, rocksdb, sqlite and redis.
dhotson · 2013-07-23
There are a few approaches for extracting colors from an image.
Shameless plug: I helped write a library called colorific to do it:
https://github.com/99designs/colorific
More about how it works here:
http://99designs.com/tech-blog/blog/2012/05/11/color-analysis/
Clustering techniques can also work quite well:
http://charlesleifer.com/blog/using-python-and-k-means-to-find-the-dom…
jackolas · 2012-01-30
Links for other folks:
https://github.com/coleifer/peewee/
http://pypi.python.org/pypi/peewee/0.8.1
http://charlesleifer.com/blog/peewee-a-lightweight-python-orm/
This is really cool thanks!
samsquire · 2023-06-14
Thanks for another thing I need to add to my reading list in addition to The Art of Multiprocessor Programming.
I am really interested in parallel, asynchronous, multithreading, coroutine, futures programming so it's what I spend my days thinking about and blogging about it. I hope you sense my excitement in this comment about this topic. I'm looking for a programming model that parallelises easily and doesn't require much effort, so this PDF seems relevant to me. I really should try be a user of languages like Erlang, Inko, Pony and Go but I am too interested in the mechanism of these languages!
I am also learning from Erlang and Go, nginx and LMAX disruptor.
I don't focus on number crunching parallelisation, I let libraries and frameworks parallelise matrix multiplication such as BLAS. I'm interested in rote system parallelisation architecture. For example, PHP and nodejs is not a parallel language but how PHP is hosted in FastCGI processes means it can be executed multiple times by nginx so it is in effect parallel across requests. Unfortunately PHP and nodejs cannot create threads or use a thread pool within a request.
I want heavy CPU tasks of a request to not block other requests or the event loop and heavy IO requests to not block the event loop. I am a pre-beginner in Rust but I think you can use Rayon for CPU heavy tasks and Tokio for async IO parallelisation.
Here's a system diagram that I'm thinking about…