A native hybrid of key-value and SQL, from the sensor to the gateway.
AltSql is one small engine and one set of records. On the device it keeps key-value and time-series data in flash. On the gateway it answers SQL. The records are the same on both, byte for byte, so there's nothing to translate in between. The device keeps working and deciding when the network is gone, and it sends less.
Status: 0.5.1, an alpha (AltSql Core, AltSql DB and AltSql Restore share the version). Written to prove the design and measure it. Everything runs on a PC in simulation; nothing has run on a microcontroller or a gateway yet. File formats may still change. Not for production.
| Folder | What it is |
|---|---|
core/ |
AltSql Core, the engine: key-value and time-series on the device, SQL on the gateway. The whole engine is one C99 file, core/dist/altsql.h. |
engines/db/ |
AltSql DB, the database for a gateway that serves a whole fleet: one file for every device, read by key with no SQL step, or with SQL, with secondary indexes and statement savepoints. Built on AltSql Core. |
engines/restore/ |
AltSql Restore, a module: a backup restore verifier. It restores last night's PostgreSQL or MySQL dump, SQLite file or file archive into a throwaway sandbox, counts and checksums every table, compares with the last good run (kept in an AltSql DB file), and alerts when the restore fails or data shrank. Each run writes a sealed report. |
demos/db/ |
The AltSql DB browser demo. Open demos/db/app/index.html; it runs straight from the folder. |
Two command-line shells come with them: altsql for a device's database
(core/tools/cli.c) and altsql-db for a gateway's (engines/db/tools/shell.c).
The release archives also hold altsql-restore, AltSql Restore's program.
Ready-built binaries for Linux (x86-64 and ARM64) and macOS (Apple silicon
and Intel) are on the latest release,
with the release notes. For Linux x86-64, say:
curl -LO https://github.com/AltSql/altsql/releases/latest/download/altsql_linux_amd64.tar.gz
tar xzf altsql_linux_amd64.tar.gz && ./altsql-db --versionLinux or macOS, gcc or clang:
cd core && make test
cd engines/db && make test
cd engines/restore && make testThe shells: cd core && make build/altsql, then cd engines/db && make shell.
make test-shell in engines/db carries records from a device file to a
gateway file with both shells and checks every answer.
Each folder's README says what each test checks, what was measured and the
known limits. The logs behind the numbers are in core/results/alpha/,
engines/db/results/ and engines/restore/results/.
altsql-restore --job shop-db --report-dir /var/log/altsql-restore /backups/shop-latest.sql.gzExit status 0 means the backup restored and no table shrank past the threshold (10% by default); 1 means the restore failed or data shrank; 3 means it could not be verified here (no PostgreSQL or MySQL server and no Docker), which it never reports as a pass. SQLite files, tar archives and folders need no other software. The whole manual, with every option, is engines/restore/README.md.
- AltSql Core: https://altsql.com/demo/core/
- AltSql DB: https://altsql.com/demo/db/
More about AltSql: https://altsql.com
See SECURITY.md.
Apache License 2.0. Copyright 2026 AltSql.com. See LICENSE and NOTICE. Everything in this repository is under Apache 2.0 unless a file says otherwise. The static Linux release binaries also contain musl libc, under the MIT license; see THIRD-PARTY-LICENSES.txt.