Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/dogsheep/apple-notes-to-sqlite
Export Apple Notes to SQLite
https://github.com/dogsheep/apple-notes-to-sqlite
apple-notes datasette datasette-tool dogsheep sqlite
Last synced: 5 days ago
JSON representation
Export Apple Notes to SQLite
- Host: GitHub
- URL: https://github.com/dogsheep/apple-notes-to-sqlite
- Owner: dogsheep
- License: apache-2.0
- Created: 2023-03-09T03:44:10.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2023-09-04T23:48:28.000Z (over 1 year ago)
- Last Synced: 2025-02-06T21:09:47.088Z (13 days ago)
- Topics: apple-notes, datasette, datasette-tool, dogsheep, sqlite
- Language: Python
- Homepage:
- Size: 20.5 KB
- Stars: 196
- Watchers: 7
- Forks: 9
- Open Issues: 9
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# apple-notes-to-sqlite
[](https://pypi.org/project/apple-notes-to-sqlite/)
[](https://github.com/dogsheep/apple-notes-to-sqlite/releases)
[](https://github.com/dogsheep/apple-notes-to-sqlite/actions?query=workflow%3ATest)
[](https://github.com/dogsheep/apple-notes-to-sqlite/blob/master/LICENSE)Export Apple Notes to SQLite
## Installation
Install this tool using `pip`:
pip install apple-notes-to-sqlite
## Usage
For help, run:
apple-notes-to-sqlite --help
You can also use:
python -m apple_notes_to_sqlite --help
To save your notes to a SQLite database called `notes.db` run:
apple-notes-to-sqlite notes.db
A progress bar will be shown.
You can stop it after a specified number of notes using `--stop-after`:
apple-notes-to-sqlite notes.db --stop-after 10
To dump the notes to standard output out as newline-delimited JSON, rather than saving them to a database, use the `--dump` option:
apple-notes-to-sqlite --dump
## Schema
The database schema generated by this tool looks like this:
```sql
CREATE TABLE [folders] (
[id] INTEGER PRIMARY KEY,
[long_id] TEXT,
[name] TEXT,
[parent] INTEGER,
FOREIGN KEY([parent]) REFERENCES [folders]([id])
);
CREATE TABLE [notes] (
[id] TEXT PRIMARY KEY,
[created] TEXT,
[updated] TEXT,
[folder] INTEGER,
[title] TEXT,
[body] TEXT,
FOREIGN KEY([folder]) REFERENCES [folders]([id])
);
CREATE UNIQUE INDEX [idx_folders_long_id]
ON [folders] ([long_id]);
```### apple-notes-to-sqlite --help
```
Usage: apple-notes-to-sqlite [OPTIONS] [DB_PATH]Export Apple Notes to SQLite
Example usage:
apple-notes-to-sqlite notes.db
This will populate notes.db with 'notes' and 'folders' tables containing all
of your notes.Options:
--version Show the version and exit.
--stop-after INTEGER Stop after this many notes
--dump Output notes to standard output
--schema Create database schema and exit
--help Show this message and exit.```
## Development
To contribute to this tool, first checkout the code. Then create a new virtual environment:
cd apple-notes-to-sqlite
python -m venv venv
source venv/bin/activateNow install the dependencies and test dependencies:
pip install -e '.[test]'
To run the tests:
pytest