nalgeon / sqlean
- четверг, 15 декабря 2022 г. в 00:35:31
The ultimate set of SQLite extensions
SQLite has few functions compared to other database management systems. SQLite authors see this as a feature rather than a problem, because SQLite has an extension mechanism in place.
There are a lot of SQLite extensions out there, but they are incomplete, inconsistent and scattered across the internet. sqlean
brings them together, neatly packaged into domain modules, documented, tested, and built for Linux, Windows and macOS.
We do not try to gather all the existing extensions into one giant pile — that would not be very useful. The goal is to create a well-thought set of domain modules with a convenient API. A kind of standard library for SQLite.
To achieve it, we split extensions that are too broad, merge the ones that are too narrow, refactor, add missing features, test, document, and do a ton of other small things.
These are the most popular functions. They are tested, documented and organized into the domain modules with clear API.
Think of them as the extended standard library for SQLite:
These extensions haven't yet made their way to the main set. They may be untested, poorly documented, too broad, too narrow, or without a well-thought API.
Think of them as candidates for the standard library:
hex()
Vote for your favorites! We'll refactor and merge popular ones into the main set.
There are precompiled binaries for every OS:
sqlean-win-x64.zip
- for Windowssqlean-linux-x86.zip
- for Linuxsqlean-macos-x86.zip
- for Intel-based macOSsqlean-macos-arm64.zip
- for Apple silicon (ARM-based) macOSBinaries are 64-bit and require a 64-bit SQLite version. If you are using SQLite shell on Windows (sqlite.exe
), its 64-bit version is available at https://github.com/nalgeon/sqlite.
Incubator extensions are also available.
CLI usage:
sqlite> .load ./stats
sqlite> select median(value) from generate_series(1, 99);
IDE usage:
select load_extension('c:\Users\anton\sqlite\stats.dll');
select median(value) from generate_series(1, 99);
In-app usage:
import sqlite3
connection = sqlite3.connect(":memory:")
connection.enable_load_extension(True)
connection.load_extension("./stats.so")
connection.execute("select median(value) from generate_series(1, 99)")
connection.close()
You can specify any other supported extension instead of stats
.
Contributions are welcome! Submit your own or third-party extension to the incubator:
We want every extension to be self-contained. So we limit the project scope to extensions without external dependencies (other than the C standard library and SQLite itself).
Please note that we only accept extensions with permissive licenses (MIT License, Apache License etc) or public domain. Copyleft licenses like GPL won't do.
Copyright 2021+ Anton Zhiyanov, Contributors and Third-party Authors.
The software is available under the MIT License.
Follow @ohmypy on Twitter to keep up with new features