Files
heygo/scripts

Django Links Export Tool

Standalone Python script to export shortlinks from the old Linux/Django links app SQLite database into JSONL format suitable for import into the Cloudflare D1 shortlinks system.

Usage

# Export from a Django SQLite DB to stdout
python3 scripts/export-django-links.py --db /path/to/db.sqlite3

# Export to file
python3 scripts/export-django-links.py --db /path/to/db.sqlite3 --output ./export.jsonl

# Use env var instead of --db
export DJANGO_DB_PATH=/path/to/db.sqlite3
python3 scripts/export-django-links.py --output ./export.jsonl

# Filter by owner email (only when links_link has an owner FK column)
python3 scripts/export-django-links.py --db /path/to/db.sqlite3 --owner-email admin@example.com

Output format

Line-delimited JSON (JSONL). Each line:

{"alias":"claude","link_type":"redirect","target_url":"https://claude.ai","content_markdown":"","description":"","tags":["ai","tools"],"created_at":"...","updated_at":"..."}

Running tests

python3 scripts/export-django-links.test.py