Convert a Claude.ai export to SQLite
Install this tool using pip:
pip install claude-to-sqliteStart by exporting your Claude data. You will be emailed a link to a zip file (though it may be missing the .zip extension).
Run the command like this:
claude-to-sqlite claude-export.zip claude.dbNow claude.db will be a SQLite containing the conversations and messages from your Claude export.
You can explore that using Datasette:
datasette claude.dbAssuming the Claude export JSON has not changed since this tool was last released on 20th October 2024 the database tables should look like this:
CREATE TABLE [conversations] (
[uuid] TEXT PRIMARY KEY,
[name] TEXT,
[created_at] TEXT,
[updated_at] TEXT,
[account_id] TEXT
);
CREATE TABLE [messages] (
[uuid] TEXT PRIMARY KEY,
[text] TEXT,
[sender] TEXT,
[created_at] TEXT,
[updated_at] TEXT,
[attachments] TEXT,
[files] TEXT,
[conversation_id] TEXT REFERENCES [conversations]([uuid])
);
CREATE TABLE [artifacts] (
[id] TEXT PRIMARY KEY,
[artifact] TEXT,
[identifier] TEXT,
[version] INTEGER,
[type] TEXT,
[language] TEXT,
[title] TEXT,
[content] TEXT,
[thinking] TEXT,
[conversation_id] TEXT REFERENCES [conversations]([uuid]),
[message_id] TEXT REFERENCES [messages]([uuid])
);To contribute to this tool, first checkout the code. Then create a new virtual environment:
cd claude-to-sqlite
python -m venv venv
source venv/bin/activateNow install the dependencies and test dependencies:
pip install -e '.[test]'To run the tests:
python -m pytest