Skip to content

simonw/claude-to-sqlite

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

claude-to-sqlite

PyPI Changelog Tests License

Convert a Claude.ai export to SQLite

Installation

Install this tool using pip:

pip install claude-to-sqlite

Usage

Start 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.db

Now claude.db will be a SQLite containing the conversations and messages from your Claude export.

You can explore that using Datasette:

datasette claude.db

Database schema

Assuming 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])
);

Development

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/activate

Now install the dependencies and test dependencies:

pip install -e '.[test]'

To run the tests:

python -m pytest

About

Convert a Claude.ai export to SQLite

Resources

License

Stars

56 stars

Watchers

1 watching

Forks

Packages

 
 
 

Contributors

Languages