AlarmDB
AlarmDB is a memory-addressed, schema-driven row-based database backed by the Apple Clock app. It also comes with NyQL, a bespoke SQL-like query language for interfacing with AlarmDB.
Read the full writeup here!
Example queries
Interfacing with AlarmDB is simple thanks to NyQL, a SQL-like query language. In the examples below, we perform "Alarmception" and encode alarm data as alarms in AlarmDB. Note the absence of the FROM clause, as there is only one table.
-- Clears all rows and sets the schema for the table
-- Note that the total number of bytes cannot exceed 32
-- (column name, type, number of bytes)
SET SCHEMA
("alarm_name", TEXT, 8),
("repeat_bitmask", UINT, 1),
("hours", INT, 1),
("minutes", INT, 1),
("enabled", BOOLEAN, 1),
("allows_snooze", BOOLEAN, 1),
("timestamp_added", TIMESTAMP, 4);
-- Get the current schema
GET SCHEMA;
"""
Outputs ->
col_name,type,length_bytes
alarm_name,TEXT,16
repeat_bitmask,UINT,1
hours,INT,1
minutes,INT,1
enabled,BOOLEAN,1
allows_snooze,BOOLEAN,1
timestamp_added,TIMESTAMP,4
"""
-- Add rows
INSERT VALUES
("work", 62, 8, 15, TRUE, FALSE, 1778904247),
("do laundry", 8, 18, 0, TRUE, TRUE, 1778904372),
("write readme", 0, 19, 45, FALSE, TRUE, 1778905161);
-- Get all rows
SELECT *;
"""
Outputs ->
alarm_name,repeat_bitmask,hours,minutes,enabled,allows_snooze,timestamp_added
work,62,8,15,True,False,2026-05-16 00:04:07
do laundry,8,18,0,True,True,2026-05-16 00:06:12
write readme,0,19,45,False,True,2026-05-16 00:19:21
"""
-- More complex SELECT queries
SELECT AVG(hours) AS avg_hours, enabled GROUP BY enabled HAVING enabled;
"""
Outputs ->
avg_hours,enabled
13.0,True
"""
SELECT alarm_name AS morning_alarm_names WHERE hours < 12 AND enabled;
"""
Outputs ->
morning_alarm_names
work
"""
SELECT alarm_name, hours, minutes ORDER BY minutes DESC LIMIT 2;
"""
Outputs ->
alarm_name,hours,minutes
write readme,19,45
work,8,15
"""
-- Delete by condition
DELETE WHERE alarm_name = "write readme";
SELECT *;
"""
Outputs ->
alarm_name,repeat_bitmask,hours,minutes,enabled,allows_snooze,timestamp_added
work,62,8,15,True,False,2026-05-16 00:04:07
do laundry,8,18,0,True,True,2026-05-16 00:06:12
"""
-- Update by condition
UPDATE SET alarm_name = "pick up laundry", hours = 20 WHERE alarm_name = "do laundry";
SELECT *;
"""
Outputs ->
alarm_name,repeat_bitmask,hours,minutes,enabled,allows_snooze,timestamp_added
work,62,8,15,True,False,2026-05-16T00:04:07
pick up laundry,8,20,0,True,True,2026-05-16T00:06:12
"""
-- Set a new schema (this also wipes the database)
SET SCHEMA ("name", TEXT, 8), ("age", INT, 1);
Installing AlarmDB
AlarmDB is easy-to-use, open-source, and free. To get started, clone this repo and install the required packages with uv sync. Then, install the following Shortcuts:
- NyQL write (called internally)
- NyQL read (called internally)
- NyQL (entrypoint)
Notes:
- You will need to update the placeholder
cd /path/to/your/alarmdbin theRun Shell Scriptaction of theNyQLshortcut to point to your local copy of this repo - If running on iOS, the
Run Shell Scriptwill need to be replaced with an equivalentRun Script Over SSHaction - It's convenient to add the
AlarmDBshortcut to Quick Actions so that you can run NyQL anywhere by highlighting the text, right clicking, andServices > NyQL
Recommended IDEs
- Notes app
- Messages app
Release files for alarmdb 1.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| alarmdb-1.2.0.tar.gz | 71.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| alarmdb-1.2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 86.2 kB
Release files / alarmdb-1.2.0.tar.gz
| Download URL | alarmdb-1.2.0.tar.gz |
|---|---|
| Size | 71.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
18f595329c4fc41473b8daf5b6b96ed978ac9299dbb5d32ef9c8c91ddd5f20a6
|
|
BLAKE2b-256 checksum How to use checksums |
5f9c50ee24014e95375c4316ec1ea169fc8909eadc7ca6036f527fe17686ced6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 26, 2026.
Transparency logRelease files / alarmdb-1.2.0-py3-none-any.whl
| Download URL | alarmdb-1.2.0-py3-none-any.whl |
|---|---|
| Size | 14.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
fb609c0a0e9c3ddf833fff177c9bfd122f93d545a48380e50b5a444bd04da89e
|
|
BLAKE2b-256 checksum How to use checksums |
69f7466273c4b39b3f91147617dfc531514c4eb59f8a4bc878c0fd86d6dc3a9e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 26, 2026.
Transparency log