Skip to main content

Garmin FIT file loader for SQLite + Grafana

Project description

GraFIT

Loads Garmin FIT files into a SQLite database and visualizes them in Grafana.

GraFIT parses .fit files (activities, sleep, GPS, etc.) using python-fitparse, writes them to SQLite using a schema generated from the FIT profile, and ships with Grafana provisioning (datasource + dashboards) so you can browse the data immediately.

Install

uv tool install grafit

Or run without installing:

uvx grafit <command> [options]

Requires Python 3.11+.

Usage

uv run grafit <command> [options]

Commands

  • init <db_path> — create and initialize the SQLite database.
  • import <path> <db_path> — import a FIT file or directory of FIT files into the database.
    • --force reimport files already present in the database.
    • --no-recursive do not recurse into subdirectories.
    • --fetch-weather look up historical hourly weather (temperature, apparent temperature, humidity) for each session's start coordinates and date from the Open-Meteo archive. Failures are logged and skipped — the FIT import itself never fails because of weather.
  • backfill-weather <db_path> — fetch weather for sessions already imported without --fetch-weather. Safe to re-run: only sessions missing weather are queried; rate-limited or failed sessions are picked up on the next run.
    • --force re-fetch weather even for sessions that already have it.
  • stats <db_path> — show row counts per table.
  • purge <db_path> --file-hash <sha256> — remove all rows imported from a given file.
  • generate-schema <output> — write the full DDL SQL to a file.
  • install-provisioning <dest> — copy the bundled Grafana provisioning (datasource + dashboards) to a directory.
    • --force overwrite the destination if it exists.

Global flag: -v / --verbose for debug logging.

Upgrading

The schema is generated from the FIT profile, so upgrading GraFIT (or its python-fitparse dependency) can add new fields. On the next import/init, missing columns are added to existing tables automatically (you'll see a Schema: added N new column(s) notice). New columns are NULL for already-imported rows — to backfill history, re-import the affected files with --force or rebuild the database from your FIT source.

Grafana

A docker-compose.yml is provided to run Grafana with the SQLite datasource plugin against ./fit_data.db and the bundled dashboards mounted from ./grafana-provisioning.

Note: the bundled compose file enables anonymous admin access and disables the login form. It is intended for local use only — do not expose it to a network.

Drop your FIT files into ./GARMIN and bring it up:

docker compose up

A grafit-init container installs the bundled provisioning, runs grafit init, and runs grafit import ./GARMIN against shared volumes; Grafana waits for it to finish before starting. Re-running docker compose up reuses the database — already-imported files are skipped by hash.

Grafana is then available at http://localhost:3000.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

grafit-1.29.1.tar.gz (34.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

grafit-1.29.1-py3-none-any.whl (44.7 kB view details)

Uploaded Python 3

File details

Details for the file grafit-1.29.1.tar.gz.

File metadata

  • Download URL: grafit-1.29.1.tar.gz
  • Upload date:
  • Size: 34.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.21 {"installer":{"name":"uv","version":"0.11.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"10","id":"buster","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for grafit-1.29.1.tar.gz
Algorithm Hash digest
SHA256 d4436fe2c87669054c20018a8f12621ec25a5d966e0400e7be83d614cbd729d8
MD5 f50a1da91b995bafd7d04aa55fb38131
BLAKE2b-256 6ec013b395d4424b16ec5dd9213823302fa173e6ec7fe55cbe3a3ba4a348eef6

See more details on using hashes here.

File details

Details for the file grafit-1.29.1-py3-none-any.whl.

File metadata

  • Download URL: grafit-1.29.1-py3-none-any.whl
  • Upload date:
  • Size: 44.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.21 {"installer":{"name":"uv","version":"0.11.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"10","id":"buster","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for grafit-1.29.1-py3-none-any.whl
Algorithm Hash digest
SHA256 86402be88525629f1a2c4890cb19e8f1460e2ff30c3796f1913adb89c3d83db4
MD5 2fb8ab41143ecb1324362809c4232f7e
BLAKE2b-256 1c16b5f7132007f78e5d9a917cc9e40c21ff0e28101182b3b693c138e2bf5932

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page