Scheduled notebooks on your own machine
Run SQLly notebooks from sqlly-cli and launchd, systemd or Task Scheduler, with exit codes, CI checks and alerts. No cloud runner, no email yet.
Once a notebook has tests in it, the obvious next question is "can it run every morning and tell me when one fails?" Hosted notebook tools answer that with their cloud. SQLly doesn't have a cloud runner, and I'm not going to pretend it does.
What it has is a command-line runner and your own computer's scheduler. This post covers both, including the parts where "your own computer" is a real limit. It's the ninth in a series about SQLly notebooks.
Scheduled notebooks run only while this computer is on. If it's asleep or off at the scheduled time, that run doesn't happen then. On macOS and Windows, jobs also need you to be logged in, and on Linux too unless you turn on lingering.
What scheduled runs leave in the History rail, and a compare with the run before. The scheduling itself happens in sqlly-cli, which this recording doesn't show. Watch the whole recording, with chapters.
The runner is sqlly-cli, and it's already installed
sqlly-cli notebook runs a notebook without opening the app, using the connections you saved in SQLly and the passwords already in your keychain. It ships inside the app, next to the app's own executable, which also means it's usually not on your PATH. That's annoying, and I haven't fixed it. Add the folder to your PATH or call it by its full path. Any Copy CLI command button in SQLly, like the one in the backup dialog, copies a line that starts with the full path, which is the quickest way to find it.
sqlly-cli notebook run revenue.sqllynb \
--param region=EMEA --param since=2026-01-01 \
--connection warehouse="Storefront Prod"
Before it runs anything, it checks the file. Oversized or deeply nested files, connections that carry passwords, and attachment paths that leave the notebook's folder are refused before the notebook is even parsed. Then it maps each connection slot to a saved connection, by stored id or by the one you name. A slot is never matched by its label alone. Then it checks trust. A notebook you made or trusted in the app is fine. For one from elsewhere, --trust on run trusts it for that run only. On schedule add, --trust saves the grant for scheduled runs.
The exit codes are meant for scripts: 0 when nothing failed, 1 when a cell failed or was blocked, 2 for a usage error, 3 when the run was refused (untrusted, a write cell, production not allowed, or the file scan said no), 4 when a test failed, and 130 for Ctrl+C. Cells run in dependency order with references folded the same way the app does, and every run is recorded with its parameters, outcomes, check results and KPI values.
Check notebooks in CI without running them
sqlly-cli notebook validate runs nothing. It reports circular references, references to cells that don't exist, unknown cell kinds, unmapped connection slots, cells that change data, read-only cells whose SQL writes, production connections, references that can't be folded, parameter errors and the file scan's findings. A CI machine without your saved connections can still validate.
# .github/workflows/notebooks.yml (excerpt)
- name: Check notebooks
run: |
for f in notebooks/*.sqllynb; do
sqlly-cli notebook validate "$f" --strict
done
For code review, sqlly-cli notebook cat turns a notebook into readable text for git diff, and sqlly-cli notebook diff compares two versions cell by cell: added, removed, moved and renamed cells, a line diff of each changed source, and changes to settings, safety policy, connections and parameters.
Schedules use launchd, systemd or Task Scheduler
sqlly-cli notebook schedule add revenue.sqllynb \
--cron "0 7 * * 1-5" --tz Europe/London \
--param-set weekday.json \
--notify desktop --notify webhook:https://hooks.example.com/sqlly \
--quiet-hours 22:00-07:00
That installs a job with the OS scheduler: launchd on macOS, a systemd user timer on Linux (crontab when systemd isn't there), and Task Scheduler on Windows. On macOS and Windows, jobs only run while you're logged in. On Linux it's a systemd user timer, which stops when you log out unless lingering is on for your user. schedule add warns you when it isn't, and --enable-linger turns it on (your system may ask for a password). SQLly never turns it on without being asked. A missed run catches up once, the next time the timer starts. Crontab, the fallback, runs whenever the computer is on.
Where the OS scheduler can't express a schedule, like a time zone other than the computer's on macOS or Windows, SQLly installs one job that wakes every minute and runs whatever is due. Missed times collapse into one run. Daylight saving is handled the boring way: a job runs once when the clock jumps forward over it, and once, at the first occurrence, when it falls back.
A scheduled run can't ask you anything, so every question the app would ask becomes a refusal. The notebook has to be fully trusted. If any cell is allowed to change data, the whole schedule is refused, because nobody's there to review the change. Production connections are refused unless you pass --allow-production, and only for read-only cells. If the notebook's SQL or connections change after you schedule it, scheduled runs stop until you trust it again.
Errors are retried twice by default, starting a minute later and doubling, up to an hour. A refusal isn't retried. After five runs in a row that error or are refused, the job pauses itself (failed tests don't count toward that), and schedule run-now runs it by hand and resumes it.
Alerts fire when something changes
By default a schedule alerts on a failed run, a failed test, or a KPI crossing its warning or critical threshold. You can add an alert for results cut short by a row limit. An alert goes out when a condition starts, with one recovery note when it stops. Not on every run while it stays broken.
Checks and KPIs computed from incomplete data never alert unless you ask with --include-incomplete. During quiet hours only critical alerts go out, and the rest are sent at the first run afterwards if they still hold.
Alerts go to a desktop notification (Notification Center on macOS, a toast on Windows, notify-send on Linux) or a webhook. The webhook is a JSON POST to an HTTPS URL with a 10-second timeout and no redirects. URLs with a user name or password in them are refused. A lot of webhook URLs carry a token, so the URL goes into your system keychain and the job file keeps only a reference to it. On a Linux machine with no keychain service running, adding a webhook fails with an error instead of falling back to a file. The body names the job, the notebook, the run id and each alert, with cell names and counts only. Never values, SQL or connection details.
{"source": "sqlly-notebook", "job": "…", "notebook": "Revenue review", "run_id": "…", "alerts": [ … ]}
No email, and the other gaps
SQLly can't send alert email. It would need a mail client library that isn't part of the app today. Most mail and chat services have an incoming-webhook address, so point a webhook at one of those instead.
The CLI only runs SQL, Tests, KPI and data attachment cells, and a scheduled run reads only attachment files inside the notebook's folder. Chart, table and pivot cells don't need to run and still appear in exports. Profile, diff, plan, entity detail, AI, transform and formula cells don't run headless yet, so a notebook that leans on transforms or formulas needs the app. Retries wait inside the scheduled run, so a job with long backoffs keeps its process running. The CLI's output is English only. And there's no schedule editor in the app yet. Schedules are CLI-only for now.
--trust when you add it, and no cells that change data.
The details are on The sqlly notebook CLI and Schedules and alerts. The last post in the series is about the trust model those refusals rest on, and a bug in my own first version of it. If you schedule a notebook and it doesn't fire when you expect, send me the schedule list output and your OS. I can't test every machine's scheduler myself.