Skip to main content

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:

Notes:

  • You will need to update the placeholder cd /path/to/your/alarmdb in the Run Shell Script action of the NyQL shortcut to point to your local copy of this repo
  • If running on iOS, the Run Shell Script will need to be replaced with an equivalent Run Script Over SSH action
  • It's convenient to add the AlarmDB shortcut to Quick Actions so that you can run NyQL anywhere by highlighting the text, right clicking, and Services > 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)

Source distribution for alarmdb 1.2.0
File Size Uploaded
alarmdb-1.2.0.tar.gz 71.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for alarmdb 1.2.0
File Interpreter ABI Platform
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 log

Release 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

Release history Release notifications | RSS feed

This release

1.2.0 This release

2 release files

1.1.0

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page