Skip to main content

apple-health-to-sqlite

CI PyPI version Python versions

Your iPhone and Apple Watch have been taking notes for years: every step, every heartbeat they sampled, every night's sleep stages, every workout with its GPS route. The Health app shows you that a day at a time. This tool turns the whole export into one SQLite database, so you can ask it anything — and, with Datasette, browse it as a website on your own machine.

uvx apple-health-to-sqlite import Export.zip mine/

That is the whole setup, given uv. The tool has no runtime dependencies, so nothing else gets installed, and it stays light even on an export of several gigabytes.

What you can ask it

Datasette opens with nineteen ready-made questions, one click each:

  • How many steps per day — with 7- and 28-day averages, by weekday, by week?
  • How long did I sleep each night, when did I go to bed, and how did that night show up in the next day's resting heart rate and HRV?
  • Which workouts did I do, how much of them was moving rather than standing around, and where did the routes go? (on a map)
  • How often did I close my activity rings?
  • What is actually in my export — which metrics, from which device, since when, and where are the gaps?

And because it is plain SQLite, anything else is one query away:

select local_date, coalesce(deduplicated_value, day_value) as steps
from daily_metrics
where type_short = 'StepCount'
order by local_date desc

Try it in a minute, without your own data

The project can invent a realistic export — steps, heart rate, sleep stages, workouts with routes — so you can look around before touching your own:

uvx apple-health-to-sqlite synthesize --days 120 export.zip
uvx apple-health-to-sqlite import export.zip sample/
uvx "datasette<1" sample/

Then open http://localhost:8001.

Use it on your own export

  1. On the iPhone: Health → your profile picture → Export All Health Data, and get the Export.zip onto your computer.

  2. Import it and open it:

    uvx apple-health-to-sqlite import Export.zip mine/
    uvx "datasette<1" mine/
    

The directory holds the database and Datasette's configuration, so that is all Datasette needs to be told. A new export a few months later goes into the same directory: re-importing is safe, rows you already have are skipped and new ones are added.

To keep the command around instead of going through uvx each time:

uv tool install apple-health-to-sqlite
apple-health-to-sqlite import Export.zip mine/

Why this one

  • Flat memory. The import streams. A five-year export with two million records imports in under a minute on a recent Mac and never needs more than about 55 MB.
  • Nothing silently dropped. Anything the importer does not recognise — a new element in a future iOS — is kept verbatim and reported at the end.
  • Numbers that match the Health app. When iPhone and Watch both count your steps, you get one day's steps, not twice as many.
  • Calendar days in your time zone. A night's sleep is not split at midnight UTC.
  • Built on Apple's own schema, which ships inside every export, and checks yours against it.

Your data stays yours

Everything runs locally; nothing is uploaded anywhere. Please keep it that way: do not datasette publish this database, and never attach your export or database to an issue — uvx apple-health-to-sqlite schema-diff Export.zip prints only the structure of your export and is safe to share.

Documentation

Requires uv, which fetches Python 3.11 or newer if you do not have it, and an export of HealthKit version 14 or newer (roughly iOS 16 onwards). Contributions are welcome — see CONTRIBUTING.md.

Licence

MIT.

Metadata

Release files for apple-health-to-sqlite 0.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 apple-health-to-sqlite 0.2.0
File Size Uploaded Provenance Actions
apple_health_to_sqlite-0.2.0.tar.gz 187.1 kB With provenance Details for apple_health_to_sqlite-0.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for apple-health-to-sqlite 0.2.0
File Interpreter ABI Platform Actions
apple_health_to_sqlite-0.2.0-py3-none-any.whl Python 3 none any Details for apple_health_to_sqlite-0.2.0-py3-none-any.whl

Total release size: 260.4 kB

Release files / apple_health_to_sqlite-0.2.0.tar.gz

Download URL apple_health_to_sqlite-0.2.0.tar.gz
Size 187.1 kB
Tags Source
SHA-256 checksum
How to use checksums
5191e97263c60b7a68f1ba4af30f5815cf0076adfb04f68438799786a6a4a140
BLAKE2b-256 checksum
How to use checksums
bea755c13b5a65d1b4f2adc49c41ca846fe10e9976d0f0547e1fdd4c7d4d0077
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 Nov 7, 2026.

Transparency log

Release files / apple_health_to_sqlite-0.2.0-py3-none-any.whl

Download URL apple_health_to_sqlite-0.2.0-py3-none-any.whl
Size 73.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
dd9547fc00f85e02c8f6b4df567df42003629c55a0fffa44729aff130571aaa1
BLAKE2b-256 checksum
How to use checksums
b3e6babf13954bac38c8da65553cf918bcf3d4165fc527494562aa6732eed372
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 Nov 7, 2026.

Transparency log

Security for apple-health-to-sqlite 0.2.0

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for apple_health_to_sqlite-0.2.0.tar.gz

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 Nov 7, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files Full provenance

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